From 6214963c00769a724da8c599c3aee6920f7f6c31 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 Jul 2011 08:09:21 -0600 Subject: [PATCH] main: use inline function wrapper for _mesa_reference_buffer_object() --- src/mesa/main/bufferobj.c | 11 +++++------ src/mesa/main/bufferobj.h | 12 +++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 3e28d342674..c52358ecb04 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -241,15 +241,14 @@ _mesa_delete_buffer_object(struct gl_context *ctx, /** * Set ptr to bufObj w/ reference counting. + * This is normally only called from the _mesa_reference_buffer_object() macro + * when there's a real pointer change. */ void -_mesa_reference_buffer_object(struct gl_context *ctx, - struct gl_buffer_object **ptr, - struct gl_buffer_object *bufObj) +_mesa_reference_buffer_object_(struct gl_context *ctx, + struct gl_buffer_object **ptr, + struct gl_buffer_object *bufObj) { - if (*ptr == bufObj) - return; - if (*ptr) { /* Unreference the old buffer */ GLboolean deleteFlag = GL_FALSE; diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 91fa073b649..f82e41411b7 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -75,9 +75,19 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, GLuint name, GLenum target ); extern void +_mesa_reference_buffer_object_(struct gl_context *ctx, + struct gl_buffer_object **ptr, + struct gl_buffer_object *bufObj); + +static INLINE void _mesa_reference_buffer_object(struct gl_context *ctx, struct gl_buffer_object **ptr, - struct gl_buffer_object *bufObj); + struct gl_buffer_object *bufObj) +{ + if (*ptr != bufObj) + _mesa_reference_buffer_object_(ctx, ptr, bufObj); +} + extern void _mesa_init_buffer_object_functions(struct dd_function_table *driver); -- 2.30.2