[Mesa-dev] [PATCH 4/4] gallium/u_inlines: remove the destroy variable in pipe_reference_described
Marek Olšák
maraeo at gmail.com
Fri Sep 7 21:35:29 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
---
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 820d3080a5c..b06fb111709 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 'dst' and 'src' 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 src.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