probe_utf8_pathname_composition: use internal strbuf
[gitweb.git] / builtin / apply.c
index 4aa53f7fd87d5fd23c0929360b6746f48e8e3e73..094a20f4896fa0a29d10e4fa33c656ea53616bfc 100644 (file)
@@ -698,10 +698,7 @@ static char *find_name_common(const char *line, const char *def,
        }
 
        if (root) {
-               char *ret = xmalloc(root_len + len + 1);
-               strcpy(ret, root);
-               memcpy(ret + root_len, start, len);
-               ret[root_len + len] = '\0';
+               char *ret = xstrfmt("%s%.*s", root, len, start);
                return squash_slash(ret);
        }