mesa: check constant before null check
authorTimothy Arceri <t_arceri@yahoo.com.au>
Wed, 21 May 2014 11:26:16 +0000 (21:26 +1000)
committerTimothy Arceri <t_arceri@yahoo.com.au>
Wed, 21 May 2014 20:52:03 +0000 (06:52 +1000)
For most drivers this if statement is always going to fail so check the constant value first.

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/vbo/vbo_exec_array.c

index 07ce08feff97321a0eca1ed466f422d3f5099b07..9c161ccca7290fb92331d46d04b1dee19b6a830f 100644 (file)
@@ -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 {