author | Junio C Hamano <gitster@pobox.com> | |
Wed, 19 Jan 2011 16:25:46 +0000 (08:25 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 19 Jan 2011 16:25:46 +0000 (08:25 -0800) |
* jn/maint-fast-import-object-reuse:
fast-import: insert new object entries at start of hash bucket
fast-import: insert new object entries at start of hash bucket
fast-import.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index eab68d58c394a67f4805d77b0007b583e79e24b9..613623be14c4c647e11b20fefb382b3f7438fb3c 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
{
unsigned int h = sha1[0] << 8 | sha1[1];
struct object_entry *e = object_table[h];
- struct object_entry *p = NULL;
while (e) {
if (!hashcmp(sha1, e->idx.sha1))
return e;
- p = e;
e = e->next;
}
e = new_object(sha1);
- e->next = NULL;
+ e->next = object_table[h];
e->idx.offset = 0;
- if (p)
- p->next = e;
- else
- object_table[h] = e;
+ object_table[h] = e;
return e;
}