Mesa (master): mesa: check constant before null check

Timothy Arceri tarceri at kemper.freedesktop.org
Wed May 21 20:52:17 UTC 2014


Module: Mesa
Branch: master
Commit: 5a40a0008961ff3172f78d1a61bf3516680100e1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a40a0008961ff3172f78d1a61bf3516680100e1

Author: Timothy Arceri <t_arceri at yahoo.com.au>
Date:   Wed May 21 21:26:16 2014 +1000

mesa: check constant before null check

For most drivers this if statement is always going to fail so check the constant value first.

Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/vbo/vbo_exec_array.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 07ce08f..9c161cc 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -581,9 +581,9 @@ vbo_handle_primitive_restart(struct gl_context *ctx,
 {
    struct vbo_context *vbo = vbo_context(ctx);
 
-   if ((ib != NULL) &&
-       ctx->Const.PrimitiveRestartInSoftware &&
-       ctx->Array._PrimitiveRestart) {
+   if (ctx->Const.PrimitiveRestartInSoftware &&
+       ctx->Array._PrimitiveRestart &&
+       (ib != NULL)) {
       /* Handle primitive restart in software */
       vbo_sw_primitive_restart(ctx, prim, nr_prims, ib, NULL);
    } else {




More information about the mesa-commit mailing list