From: Eric Engestrom Date: Tue, 20 Nov 2018 11:47:06 +0000 (+0000) Subject: util: use standard name for strncat() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27b9eea5575bd2a7c5e84b299a9ebb1e025beb25;p=mesa.git util: use standard name for strncat() Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt Reviewed-by: Emil Velikov Reviewed-by: Eric Anholt --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index 53c4d3cde41..cf58c3b1eaa 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -126,12 +126,12 @@ lp_build_print_value(struct gallivm_state *gallivm, params[1] = lp_build_const_string(gallivm, msg); if (length == 1) { - util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1); + strncat(format, type_fmt, sizeof(format) - strlen(format) - 1); params[2] = value; } else { for (i = 0; i < length; ++i) { LLVMValueRef param; - util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1); + strncat(format, type_fmt, sizeof(format) - strlen(format) - 1); param = LLVMBuildExtractElement(builder, value, lp_build_const_int32(gallivm, i), ""); if (type_kind == LLVMIntegerTypeKind && LLVMGetIntTypeWidth(type_ref) < sizeof(int) * 8) { @@ -146,7 +146,7 @@ lp_build_print_value(struct gallivm_state *gallivm, } } - util_strncat(format, "\n", sizeof(format) - strlen(format) - 1); + strncat(format, "\n", sizeof(format) - strlen(format) - 1); params[0] = lp_build_const_string(gallivm, format); return lp_build_print_args(gallivm, 2 + length, params); diff --git a/src/util/u_debug.c b/src/util/u_debug.c index ab3c8eb316d..465d669b69e 100644 --- a/src/util/u_debug.c +++ b/src/util/u_debug.c @@ -371,10 +371,10 @@ debug_dump_flags(const struct debug_named_value *names, unsigned long value) while (names->name) { if ((names->value & value) == names->value) { if (!first) - util_strncat(output, "|", sizeof(output) - strlen(output) - 1); + strncat(output, "|", sizeof(output) - strlen(output) - 1); else first = 0; - util_strncat(output, names->name, sizeof(output) - strlen(output) - 1); + strncat(output, names->name, sizeof(output) - strlen(output) - 1); output[sizeof(output) - 1] = '\0'; value &= ~names->value; } @@ -383,12 +383,12 @@ debug_dump_flags(const struct debug_named_value *names, unsigned long value) if (value) { if (!first) - util_strncat(output, "|", sizeof(output) - strlen(output) - 1); + strncat(output, "|", sizeof(output) - strlen(output) - 1); else first = 0; util_snprintf(rest, sizeof(rest), "0x%08lx", value); - util_strncat(output, rest, sizeof(output) - strlen(output) - 1); + strncat(output, rest, sizeof(output) - strlen(output) - 1); output[sizeof(output) - 1] = '\0'; } diff --git a/src/util/u_string.h b/src/util/u_string.h index cc97f58e02e..8d178031d8c 100644 --- a/src/util/u_string.h +++ b/src/util/u_string.h @@ -125,6 +125,7 @@ util_vasprintf(char **ret, const char *format, va_list ap) return util_vsnprintf(*ret, r + 1, format, ap); } +#define strncat util_strncat static inline char* util_strncat(char *dst, const char *src, size_t n) { @@ -184,7 +185,6 @@ util_strncmp(const char *s1, const char *s2, size_t n) #define util_sprintf sprintf #define util_strcmp strcmp #define util_strncmp strncmp -#define util_strncat strncat #define util_strcasecmp strcasecmp #endif