[Mesa-dev] [PATCH 4/4] gallium/u_inlines: remove the destroy variable in pipe_reference_described

Marek Olšák maraeo at gmail.com
Sat Sep 1 06:54:19 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/auxiliary/util/u_inlines.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 815ac5c97ac..8f468c58e6a 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -67,41 +67,38 @@ pipe_is_referenced(struct pipe_reference *src)
  * Update reference counting.
  * The old thing pointed to, if any, will be unreferenced.
  * Both 'ptr' and 'reference' may be NULL.
  * \return TRUE if the object's refcount hits zero and should be destroyed.
  */
 static inline boolean
 pipe_reference_described(struct pipe_reference *dst,
                          struct pipe_reference *src,
                          debug_reference_descriptor get_desc)
 {
-   boolean destroy = FALSE;
-
    if (dst != src) {
       /* bump the reference.count first */
       if (src) {
          MAYBE_UNUSED int count = p_atomic_inc_return(&src->count);
          assert(count != 1); /* src had to be referenced */
          debug_reference(src, get_desc, 1);
       }
 
       if (dst) {
          int count = p_atomic_dec_return(&dst->count);
          assert(count != -1); /* dst had to be referenced */
-         if (!count)
-            destroy = TRUE;
-
          debug_reference(dst, get_desc, -1);
+         if (!count)
+            return true;
       }
    }
 
-   return destroy;
+   return false;
 }
 
 static inline boolean
 pipe_reference(struct pipe_reference *dst, struct pipe_reference *src)
 {
    return pipe_reference_described(dst, src,
                                    (debug_reference_descriptor)
                                    debug_describe_reference);
 }
 
-- 
2.17.1



More information about the mesa-dev mailing list