util: use standard name for strncat()

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Eric Engestrom 2018-11-20 11:47:06 +00:00
parent 3ba199abd1
commit 27b9eea557
3 changed files with 8 additions and 8 deletions

View file

@ -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);

View file

@ -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';
}

View file

@ -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