From e9d156e9e4f92ae1ce70bd563c251b34d238c4bc Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 23 Mar 2009 18:03:13 +0100 Subject: gallium: Remove remnants of reference counting internals outside of p_refcnt.h. --- src/gallium/include/pipe/p_refcnt.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/gallium/include/pipe/p_refcnt.h') diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h index 60844e40a5..1f89453e09 100644 --- a/src/gallium/include/pipe/p_refcnt.h +++ b/src/gallium/include/pipe/p_refcnt.h @@ -51,6 +51,13 @@ pipe_reference_init(struct pipe_reference *reference, unsigned count) } +static INLINE bool +pipe_is_referenced(struct pipe_reference *reference) +{ + return p_atomic_read(&reference->count) != 0; +} + + /** * Set 'ptr' to point to 'reference' and update reference counting. * The old thing pointed to, if any, will be unreferenced first. @@ -65,12 +72,12 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference) /* bump the reference.count first */ if (reference) { - assert(p_atomic_read(&reference->count) != 0); + assert(pipe_is_referenced(reference)); p_atomic_inc(&reference->count); } if (*ptr) { - assert(p_atomic_read(&(*ptr)->count) != 0); + assert(pipe_is_referenced(*ptr)); if (p_atomic_dec_zero(&(*ptr)->count)) { destroy = TRUE; } @@ -81,6 +88,7 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference) return destroy; } + #ifdef __cplusplus } #endif -- cgit v1.2.3