[Mesa-dev] [PATCH mesa 13/13] util: use standard name for vsnprintf()
Eric Engestrom
eric.engestrom at intel.com
Tue Nov 20 13:11:13 UTC 2018
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
src/gallium/auxiliary/driver_trace/tr_dump.c | 2 +-
src/gallium/auxiliary/gallivm/lp_bld_debug.h | 2 +-
src/gallium/auxiliary/hud/hud_context.c | 2 +-
src/gallium/auxiliary/tgsi/tgsi_dump.c | 2 +-
src/gallium/auxiliary/util/u_dump_state.c | 2 +-
src/gallium/auxiliary/util/u_tests.c | 2 +-
src/gallium/drivers/i915/i915_fpc_translate.c | 2 +-
src/util/string_buffer.c | 2 +-
src/util/u_debug.c | 4 ++--
src/util/u_string.h | 15 ++++++---------
10 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/src/gallium/auxiliary/driver_trace/tr_dump.c b/src/gallium/auxiliary/driver_trace/tr_dump.c
index 49349496ac6cbac3b2ba..185df21455645d0f2aaf 100644
--- a/src/gallium/auxiliary/driver_trace/tr_dump.c
+++ b/src/gallium/auxiliary/driver_trace/tr_dump.c
@@ -87,7 +87,7 @@ trace_dump_writef(const char *format, ...)
unsigned len;
va_list ap;
va_start(ap, format);
- len = util_vsnprintf(buf, sizeof(buf), format, ap);
+ len = vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
trace_dump_write(buf, len);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
index eeef0d6ba61252a0d64c..236efea544b25409e6bf 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
@@ -69,7 +69,7 @@ lp_build_name(LLVMValueRef val, const char *format, ...)
char name[32];
va_list ap;
va_start(ap, format);
- util_vsnprintf(name, sizeof name, format, ap);
+ vsnprintf(name, sizeof name, format, ap);
va_end(ap);
LLVMSetValueName(val, name);
#else
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index e7e99944993ad8ffaf32..d3780e28db375a51d04e 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -149,7 +149,7 @@ hud_draw_string(struct hud_context *hud, unsigned x, unsigned y,
va_list ap;
va_start(ap, str);
- util_vsnprintf(buf, sizeof(buf), str, ap);
+ vsnprintf(buf, sizeof(buf), str, ap);
va_end(ap);
if (!*s)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 705d9f1cbf766609a00a..110aeb6084f33fa9cfa4 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -778,7 +778,7 @@ str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...)
int written;
va_list ap;
va_start(ap, format);
- written = util_vsnprintf(sctx->ptr, sctx->left, format, ap);
+ written = vsnprintf(sctx->ptr, sctx->left, format, ap);
va_end(ap);
/* Some complicated logic needed to handle the return value of
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 638dac79db23b498d7f3..beb2f571b35032f4070c 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -48,7 +48,7 @@ util_stream_writef(FILE *stream, const char *format, ...)
unsigned len;
va_list ap;
va_start(ap, format);
- len = util_vsnprintf(buf, sizeof(buf), format, ap);
+ len = vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
fwrite(buf, len, 1, stream);
}
diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c
index 4252b4c566551d70090c..d27ea1438c2d42a03e4b 100644
--- a/src/gallium/auxiliary/util/u_tests.c
+++ b/src/gallium/auxiliary/util/u_tests.c
@@ -284,7 +284,7 @@ util_report_result_helper(int status, const char *name, ...)
va_list ap;
va_start(ap, name);
- util_vsnprintf(buf, sizeof(buf), name, ap);
+ vsnprintf(buf, sizeof(buf), name, ap);
va_end(ap);
printf("Test(%s) = %s\n", buf,
diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c
index 2eaa1e64ef736f54bb79..28c12324195a4bd8defa 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -134,7 +134,7 @@ i915_program_error(struct i915_fp_compile *p, const char *msg, ...)
debug_printf("i915_program_error: ");
va_start( args, msg );
- util_vsnprintf( buffer, sizeof(buffer), msg, args );
+ vsnprintf( buffer, sizeof(buffer), msg, args );
va_end( args );
debug_printf("%s", buffer);
debug_printf("\n");
diff --git a/src/util/string_buffer.c b/src/util/string_buffer.c
index c33173bfa089d6d9ea90..31ebe3cb7e04d4761f46 100644
--- a/src/util/string_buffer.c
+++ b/src/util/string_buffer.c
@@ -114,7 +114,7 @@ _mesa_string_buffer_vprintf(struct _mesa_string_buffer *str,
va_copy(arg_copy, args);
uint32_t space_left = str->capacity - str->length;
- int32_t len = util_vsnprintf(str->buf + str->length,
+ int32_t len = vsnprintf(str->buf + str->length,
space_left, format, arg_copy);
va_end(arg_copy);
diff --git a/src/util/u_debug.c b/src/util/u_debug.c
index 9e547f508ca3bbc80653..421ae95227bac40eb8a5 100644
--- a/src/util/u_debug.c
+++ b/src/util/u_debug.c
@@ -54,13 +54,13 @@ _debug_vprintf(const char *format, va_list ap)
#if defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_EMBEDDED)
/* We buffer until we find a newline. */
size_t len = strlen(buf);
- int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
+ int ret = vsnprintf(buf + len, sizeof(buf) - len, format, ap);
if (ret > (int)(sizeof(buf) - len - 1) || strchr(buf + len, '\n')) {
os_log_message(buf);
buf[0] = '\0';
}
#else
- util_vsnprintf(buf, sizeof(buf), format, ap);
+ vsnprintf(buf, sizeof(buf), format, ap);
os_log_message(buf);
#endif
}
diff --git a/src/util/u_string.h b/src/util/u_string.h
index f51361d725985ffeb9ae..91c152c673002445a964 100644
--- a/src/util/u_string.h
+++ b/src/util/u_string.h
@@ -65,6 +65,7 @@ util_strchrnul(const char *s, char c)
#ifdef _WIN32
+#define vsnprintf util_vsnprintf
static inline int
util_vsnprintf(char *str, size_t size, const char *format, va_list ap)
{
@@ -90,7 +91,7 @@ util_snprintf(char *str, size_t size, const char *format, ...)
va_list ap;
int ret;
va_start(ap, format);
- ret = util_vsnprintf(str, size, format, ap);
+ ret = vsnprintf(str, size, format, ap);
va_end(ap);
return ret;
}
@@ -99,7 +100,7 @@ util_snprintf(char *str, size_t size, const char *format, ...)
static inline void
util_vsprintf(char *str, const char *format, va_list ap)
{
- util_vsnprintf(str, (size_t)-1, format, ap);
+ vsnprintf(str, (size_t)-1, format, ap);
}
#define sprintf util_sprintf
@@ -109,7 +110,7 @@ util_sprintf(char *str, const char *format, ...)
{
va_list ap;
va_start(ap, format);
- util_vsnprintf(str, (size_t)-1, format, ap);
+ vsnprintf(str, (size_t)-1, format, ap);
va_end(ap);
}
@@ -121,7 +122,7 @@ util_vasprintf(char **ret, const char *format, va_list ap)
/* Compute length of output string first */
va_copy(ap_copy, ap);
- int r = util_vsnprintf(NULL, 0, format, ap_copy);
+ int r = vsnprintf(NULL, 0, format, ap_copy);
va_end(ap_copy);
if (r < 0)
@@ -132,7 +133,7 @@ util_vasprintf(char **ret, const char *format, va_list ap)
return -1;
/* Print to buffer */
- return util_vsnprintf(*ret, r + 1, format, ap);
+ return vsnprintf(*ret, r + 1, format, ap);
}
#define strchr util_strchr
@@ -212,10 +213,6 @@ util_strstr(const char *haystack, const char *needle)
#define strcasecmp stricmp
#define strdup _strdup
-#else
-
-#define util_vsnprintf vsnprintf
-
#endif
--
Cheers,
Eric
More information about the mesa-dev
mailing list