]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diff.c
transport_anonymize_url: use xstrfmt
[thirdparty/git.git] / diff.c
diff --git a/diff.c b/diff.c
index 2136b6970b3a9751a3ec420bac61e9baa08df9b0..27d14a7d15a110cfcf7c51d9b8f3f0c1d65e1ae1 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2607,12 +2607,9 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
 
 struct diff_filespec *alloc_filespec(const char *path)
 {
-       int namelen = strlen(path);
-       struct diff_filespec *spec = xmalloc(sizeof(*spec) + namelen + 1);
+       struct diff_filespec *spec;
 
-       memset(spec, 0, sizeof(*spec));
-       spec->path = (char *)(spec + 1);
-       memcpy(spec->path, path, namelen+1);
+       FLEXPTR_ALLOC_STR(spec, path, path);
        spec->count = 1;
        spec->is_binary = -1;
        return spec;