summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d8f4790)
raw | patch | inline | side by side (parent: d8f4790)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 25 Jan 2006 11:34:10 +0000 (03:34 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 28 Jan 2006 08:08:29 +0000 (00:08 -0800) |
... and use the established pattern of tail initialized to point
at the head pointer for an empty list, and updated to point at
the next pointer field of the item at the tail when appending.
Signed-off-by: Junio C Hamano <junkio@cox.net>
at the head pointer for an empty list, and updated to point at
the next pointer field of the item at the tail when appending.
Signed-off-by: Junio C Hamano <junkio@cox.net>
combine-diff.c | patch | blob | history |
diff --git a/combine-diff.c b/combine-diff.c
index 062ed8a7bfda9e84a91597232e61f7c62d877459..eb763e113b12fb10990ce1041d89870762ed520f 100644 (file)
--- a/combine-diff.c
+++ b/combine-diff.c
int i;
if (!n) {
- struct path_list *list = NULL, *tail = NULL;
+ struct path_list *list = NULL, **tail = &list;
for (i = 0; i < q->nr; i++) {
int len;
const char *path;
p->next = NULL;
memcpy(p->sha1, q->queue[i]->two->sha1, 20);
memcpy(p->parent_sha1[n], q->queue[i]->one->sha1, 20);
- if (!tail)
- list = tail = p;
- else {
- tail->next = p;
- p = tail;
- }
+ *tail = p;
+ tail = &p->next;
}
return list;
}
lline->parent_map = this_mask;
memcpy(lline->line, line, len);
lline->line[len] = 0;
- if (sline->lost_head)
- *(sline->lost_tail) = lline;
- else
- sline->lost_head = lline;
+ *sline->lost_tail = lline;
sline->lost_tail = &lline->next;
}
sline[0].bol = result;
for (lno = 0, cp = result; cp - result < size; cp++) {
if (*cp == '\n') {
+ sline[lno].lost_tail = &sline[lno].lost_head;
sline[lno].len = cp - sline[lno].bol;
sline[lno].flag = (1UL<<num_parent) - 1;
lno++;
}
}
if (result[size-1] != '\n') {
+ sline[cnt-1].lost_tail = &sline[cnt-1].lost_head;
sline[cnt-1].len = size - (sline[cnt-1].bol - result);
sline[cnt-1].flag = (1UL<<num_parent) - 1;
}