[Mesa-dev] [PATCH 1/3] mesa: don't use %s for PACKAGE_VERSION macro

Emil Velikov emil.l.velikov at gmail.com
Tue Sep 5 14:23:23 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

The macro itself is a well defined string, which cannot cause issues
with printf or other printf-like functions.

All other places through Mesa already use it directly, so let's update
the final two instances.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/mesa/main/context.c | 4 ++--
 src/mesa/main/errors.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index cd3eccea20f..be3f3610117 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -400,8 +400,8 @@ one_time_init( struct gl_context *ctx )
 
 #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
       if (MESA_VERBOSE != 0) {
-         _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",
-                     PACKAGE_VERSION, __DATE__, __TIME__);
+         _mesa_debug(ctx, "Mesa " PACKAGE_VERSION " DEBUG build %s %s\n",
+                     __DATE__, __TIME__);
       }
 #endif
    }
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 3a40c7457a5..9173788d1de 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -172,8 +172,8 @@ _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... )
       va_start( args, fmtString );
       _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
       va_end( args );
-      fprintf(stderr, "Mesa %s implementation error: %s\n",
-              PACKAGE_VERSION, str);
+      fprintf(stderr, "Mesa " PACKAGE_VERSION " implementation error: %s\n",
+              str);
       fprintf(stderr, "Please report at " PACKAGE_BUGREPORT "\n");
    }
 }
-- 
2.14.1



More information about the mesa-dev mailing list