summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56185f4)
raw | patch | inline | side by side (parent: 56185f4)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Tue, 20 Feb 2007 02:45:49 +0000 (03:45 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 20 Feb 2007 03:02:12 +0000 (19:02 -0800) |
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-apply.c | patch | blob | history |
diff --git a/builtin-apply.c b/builtin-apply.c
index 053511e2ee23cc6a1db524bd0dbe3a25260f25dd..2a40af3ff042c840aa7ca10a76d29a015ca6a73b 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
return 1;
}
-static char *prefix_one(char *name)
+static void prefix_one(char **name)
{
- if (!name)
- return name;
- return xstrdup(prefix_filename(prefix, prefix_length, name));
+ char *old_name = *name;
+ if (!old_name)
+ return;
+ *name = xstrdup(prefix_filename(prefix, prefix_length, *name));
+ free(old_name);
}
static void prefix_patches(struct patch *p)
if (!prefix)
return;
for ( ; p; p = p->next) {
- p->new_name = prefix_one(p->new_name);
- p->old_name = prefix_one(p->old_name);
+ if (p->new_name != p->old_name)
+ prefix_one(&p->new_name);
+ prefix_one(&p->old_name);
}
}