[Mesa-dev] [PATCH 3/4] mesa: Remove deleteFlag pattern.

Timothy Arceri tarceri at itsqueeze.com
Fri Apr 21 05:20:54 UTC 2017


From: Matt Turner <mattst88 at gmail.com>

---
 src/mesa/main/arrayobj.c    | 4 +---
 src/mesa/main/pipelineobj.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 9f4477e..24555d9 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -181,28 +181,26 @@ _mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj)
  */
 void
 _mesa_reference_vao_(struct gl_context *ctx,
                      struct gl_vertex_array_object **ptr,
                      struct gl_vertex_array_object *vao)
 {
    assert(*ptr != vao);
 
    if (*ptr) {
       /* Unreference the old array object */
-      GLboolean deleteFlag = GL_FALSE;
       struct gl_vertex_array_object *oldObj = *ptr;
 
       assert(oldObj->RefCount > 0);
       oldObj->RefCount--;
-      deleteFlag = (oldObj->RefCount == 0);
 
-      if (deleteFlag)
+      if (oldObj->RefCount == 0)
          _mesa_delete_vao(ctx, oldObj);
 
       *ptr = NULL;
    }
    assert(!*ptr);
 
    if (vao) {
       /* reference new array object */
       assert(vao->RefCount > 0);
 
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index a0fa55a..9a852be 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -177,28 +177,26 @@ remove_pipeline_object(struct gl_context *ctx, struct gl_pipeline_object *obj)
  */
 void
 _mesa_reference_pipeline_object_(struct gl_context *ctx,
                                  struct gl_pipeline_object **ptr,
                                  struct gl_pipeline_object *obj)
 {
    assert(*ptr != obj);
 
    if (*ptr) {
       /* Unreference the old pipeline object */
-      GLboolean deleteFlag = GL_FALSE;
       struct gl_pipeline_object *oldObj = *ptr;
 
       assert(oldObj->RefCount > 0);
       oldObj->RefCount--;
-      deleteFlag = (oldObj->RefCount == 0);
 
-      if (deleteFlag) {
+      if (oldObj->RefCount == 0) {
          _mesa_delete_pipeline_object(ctx, oldObj);
       }
 
       *ptr = NULL;
    }
    assert(!*ptr);
 
    if (obj) {
       /* reference new pipeline object */
       assert(obj->RefCount > 0);
-- 
2.9.3



More information about the mesa-dev mailing list