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

Matt Turner mattst88 at gmail.com
Thu Aug 6 17:11:03 PDT 2015


---
 src/mesa/main/arrayobj.c    | 4 +---
 src/mesa/main/framebuffer.c | 4 +---
 src/mesa/main/pipelineobj.c | 4 +---
 src/mesa/main/shaderobj.c   | 8 ++------
 4 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index f581e4c..da6757e 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -193,14 +193,12 @@ _mesa_reference_vao_(struct gl_context *ctx,
 
    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) {
 	 assert(ctx->Driver.DeleteArrayObject);
          ctx->Driver.DeleteArrayObject(ctx, oldObj);
       }
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 475b01b..ffda182 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -237,14 +237,12 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
 {
    if (*ptr) {
       /* unreference old renderbuffer */
-      GLboolean deleteFlag = GL_FALSE;
       struct gl_framebuffer *oldFb = *ptr;
 
       assert(oldFb->RefCount > 0);
       oldFb->RefCount--;
-      deleteFlag = (oldFb->RefCount == 0);
       
-      if (deleteFlag)
+      if (oldFb->RefCount == 0)
          oldFb->Delete(oldFb);
 
       *ptr = NULL;
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index 80ac012..7c970d2 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -182,14 +182,12 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx,
 
    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);
       }
 
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 71d4ed6..7940f75 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -64,14 +64,12 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
    }
    if (*ptr) {
       /* Unreference the old shader */
-      GLboolean deleteFlag = GL_FALSE;
       struct gl_shader *old = *ptr;
 
       assert(old->RefCount > 0);
       old->RefCount--;
-      deleteFlag = (old->RefCount == 0);
 
-      if (deleteFlag) {
+      if (old->RefCount == 0) {
 	 if (old->Name != 0)
 	    _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
          ctx->Driver.DeleteShader(ctx, old);
@@ -200,14 +198,12 @@ _mesa_reference_shader_program_(struct gl_context *ctx,
    }
    if (*ptr) {
       /* Unreference the old shader program */
-      GLboolean deleteFlag = GL_FALSE;
       struct gl_shader_program *old = *ptr;
 
       assert(old->RefCount > 0);
       old->RefCount--;
-      deleteFlag = (old->RefCount == 0);
 
-      if (deleteFlag) {
+      if (old->RefCount == 0) {
 	 if (old->Name != 0)
 	    _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
          ctx->Driver.DeleteShaderProgram(ctx, old);
-- 
2.3.6



More information about the mesa-dev mailing list