[Mesa-dev] [PATCH 5/9] mesa: make _mesa_reference_array_object() an inline function
Brian Paul
brianp at vmware.com
Tue Jun 26 14:12:54 PDT 2012
As we do for texture objects, buffer objects, etc.
---
src/mesa/main/arrayobj.c | 11 ++++++-----
src/mesa/main/arrayobj.h | 12 +++++++++++-
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 4c50066..3439ab6 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -123,14 +123,15 @@ _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj )
/**
* Set ptr to arrayObj w/ reference counting.
+ * Note: this should only be called from the _mesa_reference_array_object()
+ * inline function.
*/
void
-_mesa_reference_array_object(struct gl_context *ctx,
- struct gl_array_object **ptr,
- struct gl_array_object *arrayObj)
+_mesa_reference_array_object_(struct gl_context *ctx,
+ struct gl_array_object **ptr,
+ struct gl_array_object *arrayObj)
{
- if (*ptr == arrayObj)
- return;
+ assert(*ptr != arrayObj);
if (*ptr) {
/* Unreference the old array object */
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 717c791..e5270fa 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -52,9 +52,19 @@ extern void
_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
extern void
+_mesa_reference_array_object_(struct gl_context *ctx,
+ struct gl_array_object **ptr,
+ struct gl_array_object *arrayObj);
+
+static inline void
_mesa_reference_array_object(struct gl_context *ctx,
struct gl_array_object **ptr,
- struct gl_array_object *arrayObj);
+ struct gl_array_object *arrayObj)
+{
+ if (*ptr != arrayObj)
+ _mesa_reference_array_object_(ctx, ptr, arrayObj);
+}
+
extern void
_mesa_initialize_array_object( struct gl_context *ctx,
--
1.7.3.4
More information about the mesa-dev
mailing list