Mesa (master): mesa: convert macro to inline function

Brian Paul brianp at kemper.freedesktop.org
Sat Feb 28 16:43:07 UTC 2009


Module: Mesa
Branch: master
Commit: 8bf25a17d2f8f888e8e8a4f7a2c6d68c6c06f6e8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8bf25a17d2f8f888e8e8a4f7a2c6d68c6c06f6e8

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Feb 27 22:21:42 2009 -0700

mesa: convert macro to inline function

---

 src/mesa/main/feedback.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 5073ccb..beab535 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -203,11 +203,14 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
  * Verifies there is free space in the buffer to write the value and
  * increments the pointer.
  */
-#define WRITE_RECORD( CTX, V )					\
-	if (CTX->Select.BufferCount < CTX->Select.BufferSize) {	\
-	   CTX->Select.Buffer[CTX->Select.BufferCount] = (V);	\
-	}							\
-	CTX->Select.BufferCount++;
+static INLINE void
+write_record(GLcontext *ctx, GLuint value)
+{
+   if (ctx->Select.BufferCount < ctx->Select.BufferSize) {
+      ctx->Select.Buffer[ctx->Select.BufferCount] = value;
+   }
+   ctx->Select.BufferCount++;
+}
 
 
 /**
@@ -256,11 +259,11 @@ write_hit_record(GLcontext *ctx)
    zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ);
    zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ);
 
-   WRITE_RECORD( ctx, ctx->Select.NameStackDepth );
-   WRITE_RECORD( ctx, zmin );
-   WRITE_RECORD( ctx, zmax );
+   write_record( ctx, ctx->Select.NameStackDepth );
+   write_record( ctx, zmin );
+   write_record( ctx, zmax );
    for (i = 0; i < ctx->Select.NameStackDepth; i++) {
-      WRITE_RECORD( ctx, ctx->Select.NameStack[i] );
+      write_record( ctx, ctx->Select.NameStack[i] );
    }
 
    ctx->Select.Hits++;




More information about the mesa-commit mailing list