summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-03-21 07:08:17 -0400
committerJunio C Hamano <gitster@pobox.com>2013-03-21 14:06:19 -0700
commit4db34cc134978012cf3f1b07de981a0418ed1523 (patch)
tree1d5fbb1bf265ba3b1be772c22887801dd06a7ae8 /fast-import.c
parent1c71541ddd51968ca2957063b00da42941d13d98 (diff)
downloadgit-4db34cc134978012cf3f1b07de981a0418ed1523.tar.gz
fast-import: use pointer-to-pointer to keep list tail
This is shorter, idiomatic, and it means the compiler does not get confused about whether our "e" pointer is valid, letting us drop the "e = e" hack. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fast-import.c b/fast-import.c
index c2a814ec66..583a439dba 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2613,7 +2613,7 @@ static int parse_from(struct branch *b)
static struct hash_list *parse_merge(unsigned int *count)
{
- struct hash_list *list = NULL, *n, *e = e;
+ struct hash_list *list = NULL, **tail = &list, *n;
const char *from;
struct branch *s;
@@ -2641,11 +2641,9 @@ static struct hash_list *parse_merge(unsigned int *count)
die("Invalid ref name or SHA1 expression: %s", from);
n->next = NULL;
- if (list)
- e->next = n;
- else
- list = n;
- e = n;
+ *tail = n;
+ tail = &n->next;
+
(*count)++;
read_next_command();
}