summaryrefslogtreecommitdiffstats
path: root/src/gallium/include/pipe/p_refcnt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/include/pipe/p_refcnt.h')
-rw-r--r--src/gallium/include/pipe/p_refcnt.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h
index 1f9088b3e9c..f1875b6b822 100644
--- a/src/gallium/include/pipe/p_refcnt.h
+++ b/src/gallium/include/pipe/p_refcnt.h
@@ -59,30 +59,28 @@ pipe_is_referenced(struct pipe_reference *reference)
/**
- * Set 'ptr' to point to 'reference' and update reference counting.
- * The old thing pointed to, if any, will be unreferenced first.
- * 'reference' may be NULL.
+ * Update reference counting.
+ * The old thing pointed to, if any, will be unreferenced.
+ * Both 'ptr' and 'reference' may be NULL.
*/
static INLINE bool
-pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
+pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference)
{
bool destroy = FALSE;
- if(*ptr != reference) {
+ if(ptr != reference) {
/* bump the reference.count first */
if (reference) {
assert(pipe_is_referenced(reference));
p_atomic_inc(&reference->count);
}
- if (*ptr) {
- assert(pipe_is_referenced(*ptr));
- if (p_atomic_dec_zero(&(*ptr)->count)) {
+ if (ptr) {
+ assert(pipe_is_referenced(ptr));
+ if (p_atomic_dec_zero(&ptr->count)) {
destroy = TRUE;
}
}
-
- *ptr = reference;
}
return destroy;