builtin/apply: get rid of useless 'name' variable
While at it put an 'else' on the same line as the previous '}'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Mar 22, 2016 at 21:58 UTC
fda3e2cf017493ad9051c027a527e5c995ebfaf1
1 file changed
+5
-8
builtin/apply.c
+5
-8
@@ -931,22 +931,19 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
931
return find_name(line, NULL, p_value, TERM_TAB);
932
933
if (orig_name) {
934
- int len;
935
- const char *name;
934
+ int len = strlen(orig_name);
935
char *another;
937
- name = orig_name;
938
- len = strlen(name);
936
if (isnull)
940
- die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"), name, linenr);
937
+ die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"),
938
+ orig_name, linenr);
939
another = find_name(line, NULL, p_value, TERM_TAB);
942
- if (!another || memcmp(another, name, len + 1))
940
+ if (!another || memcmp(another, orig_name, len + 1))
941
die((side == DIFF_NEW_NAME) ?
942
_("git apply: bad git-diff - inconsistent new filename on line %d") :
943
_("git apply: bad git-diff - inconsistent old filename on line %d"), linenr);
944
free(another);
945
return orig_name;
948
- }
949
- else {
946
+ } else {
947
/* expect "/dev/null" */
948
if (memcmp("/dev/null", line, 9) || line[9] != '\n')
949
die(_("git apply: bad git-diff - expected /dev/null on line %d"), linenr);