util: use standard name for strncat()
authorEric Engestrom <eric.engestrom@intel.com>
Tue, 20 Nov 2018 11:47:06 +0000 (11:47 +0000)
committerEric Engestrom <eric.engestrom@intel.com>
Fri, 19 Jul 2019 21:39:38 +0000 (22:39 +0100)
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>
src/gallium/auxiliary/gallivm/lp_bld_printf.c
src/util/u_debug.c
src/util/u_string.h

index 53c4d3c..cf58c3b 100644 (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);
index ab3c8eb..465d669 100644 (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';
    }
 
index cc97f58..8d17803 100644 (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