summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 208247a)
raw | patch | inline | side by side (parent: 208247a)
author | Ralf Thielow <ralf.thielow@googlemail.com> | |
Wed, 1 Dec 2010 19:15:59 +0000 (20:15 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 1 Dec 2010 21:16:39 +0000 (13:16 -0800) |
Bad graft data is noticed in several places in read_graft_line(), and in
each case we go back to the first site of detection. It in general is a
better style to have an exception handling out of line from the main
codepath and make error codepath jump forward.
Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
each case we go back to the first site of detection. It in general is a
better style to have an exception handling out of line from the main
codepath and make error codepath jump forward.
Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c | patch | blob | history |
diff --git a/commit.c b/commit.c
index 0094ec1c9278332f736d2814c847b272788a7dd3..2d9265d9fe1e13c0295f5ff33c0cb26201f5fce0 100644 (file)
--- a/commit.c
+++ b/commit.c
buf[--len] = '\0';
if (buf[0] == '#' || buf[0] == '\0')
return NULL;
- if ((len + 1) % 41) {
- bad_graft_data:
- error("bad graft data: %s", buf);
- free(graft);
- return NULL;
- }
+ if ((len + 1) % 41)
+ goto bad_graft_data;
i = (len + 1) / 41 - 1;
graft = xmalloc(sizeof(*graft) + 20 * i);
graft->nr_parent = i;
goto bad_graft_data;
}
return graft;
+
+bad_graft_data:
+ error("bad graft data: %s", buf);
+ free(graft);
+ return NULL;
}
static int read_graft_file(const char *graft_file)