diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-03-23 18:03:13 +0100 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-03-23 18:03:13 +0100 |
commit | e9d156e9e4f92ae1ce70bd563c251b34d238c4bc (patch) | |
tree | 564c4283ca531a0cb1f21b5439237d0d07641f33 /src/gallium/include | |
parent | da96767c8971e792285e3190c708438d65802379 (diff) |
gallium: Remove remnants of reference counting internals outside of p_refcnt.h.
Diffstat (limited to 'src/gallium/include')
-rw-r--r-- | src/gallium/include/pipe/p_refcnt.h | 12 |
1 files changed, 10 insertions, 2 deletions
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 |