mesa: use inline function wrapper for _mesa_reference_renderbuffer()
authorBrian Paul <brianp@vmware.com>
Thu, 14 Jul 2011 14:09:21 +0000 (08:09 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 14 Jul 2011 14:14:13 +0000 (08:14 -0600)
src/mesa/main/renderbuffer.c
src/mesa/main/renderbuffer.h

index f5b20020d23b044568ed4456d242f0a2dd9b4b8e..70011e6b24aafaab92feddac9257d7a09c9205a3 100644 (file)
@@ -2530,17 +2530,13 @@ _mesa_remove_renderbuffer(struct gl_framebuffer *fb,
  * Set *ptr to point to rb.  If *ptr points to another renderbuffer,
  * dereference that buffer first.  The new renderbuffer's refcount will
  * be incremented.  The old renderbuffer's refcount will be decremented.
+ * This is normally only called from the _mesa_reference_renderbuffer() macro
+ * when there's a real pointer change.
  */
 void
-_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
-                             struct gl_renderbuffer *rb)
+_mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
+                              struct gl_renderbuffer *rb)
 {
-   assert(ptr);
-   if (*ptr == rb) {
-      /* no change */
-      return;
-   }
-
    if (*ptr) {
       /* Unreference the old renderbuffer */
       GLboolean deleteFlag = GL_FALSE;
index 53da5b0338573096d282ea191cd18590002352fd..f9329d55fa53f41dd77cc256840a219fa7d5f8d5 100644 (file)
@@ -105,8 +105,17 @@ _mesa_remove_renderbuffer(struct gl_framebuffer *fb,
                           gl_buffer_index bufferName);
 
 extern void
+_mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
+                              struct gl_renderbuffer *rb);
+
+static INLINE void
 _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
-                             struct gl_renderbuffer *rb);
+                             struct gl_renderbuffer *rb)
+{
+   if (*ptr != rb)
+      _mesa_reference_renderbuffer_(ptr, rb);
+}
+      
 
 
 #endif /* RENDERBUFFER_H */