summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2018-11-20 12:02:36 +0000
committerEric Engestrom <[email protected]>2019-07-19 22:39:38 +0100
commit085c3abf27082f72978e011a652a5ece2f518099 (patch)
treef63e16e1a9f3777520ff8f1adf5d49d715f08f3b /src/util
parentdffeaa55dd1155d7a1e8feb5ecfc54fff688fcd8 (diff)
util: use standard name for vsnprintf()
Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/string_buffer.c2
-rw-r--r--src/util/u_debug.c4
-rw-r--r--src/util/u_string.h13
3 files changed, 8 insertions, 11 deletions
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