From: Eric Engestrom Date: Tue, 20 Nov 2018 12:02:36 +0000 (+0000) Subject: util: use standard name for vsnprintf() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=085c3abf27082f72978e011a652a5ece2f518099;p=mesa.git util: use standard name for vsnprintf() Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt Reviewed-by: Emil Velikov Reviewed-by: Eric Anholt --- diff --git a/src/gallium/auxiliary/driver_trace/tr_dump.c b/src/gallium/auxiliary/driver_trace/tr_dump.c index 49349496ac6..185df214556 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 406f628e158..1ea13326458 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h @@ -70,7 +70,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 e7e99944993..d3780e28db3 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 705d9f1cbf7..110aeb6084f 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 6b11f10408a..5e312bda121 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 a5a54a4d2c9..cba9237670e 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 2eaa1e64ef7..28c12324195 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 c33173bfa08..31ebe3cb7e0 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 9e547f508ca..421ae95227b 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 456de63d288..055d769fe13 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; } @@ -102,7 +103,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); } @@ -114,7 +115,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) @@ -125,7 +126,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 strncat util_strncat @@ -182,10 +183,6 @@ util_strncmp(const char *s1, const char *s2, size_t n) #define strcasecmp stricmp #define strdup _strdup -#else - -#define util_vsnprintf vsnprintf - #endif