summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorOlga Telezhnaya <olyatelezhnaya@gmail.com>2017-09-30 17:51:01 +0000
committerJunio C Hamano <gitster@pobox.com>2017-10-01 17:30:26 +0900
commit8865859dfc346c61f0e75fa429c5d307bd27368c (patch)
tree81b8f55f9ca4f3e4c523a5f2072feccf792e176e /builtin/pack-objects.c
parent20fed7cad40ed0b96232feb828129e3a2ee9860d (diff)
downloadgit-ot/mru-on-list.tar.gz
mru: use double-linked list from list.hot/mru-on-list
Simplify mru.[ch] and related code by reusing the double-linked list implementation from list.h instead of a custom one. This commit is an intermediate step. Our final goal is to get rid of mru.[ch] at all and inline all logic. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored by: Jeff King <peff@peff.net> Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index f721137eaf..ba812349e0 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -995,8 +995,8 @@ static int want_object_in_pack(const unsigned char *sha1,
struct packed_git **found_pack,
off_t *found_offset)
{
- struct mru_entry *entry;
int want;
+ struct list_head *pos;
if (!exclude && local && has_loose_object_nonlocal(sha1))
return 0;
@@ -1012,7 +1012,8 @@ static int want_object_in_pack(const unsigned char *sha1,
return want;
}
- for (entry = packed_git_mru.head; entry; entry = entry->next) {
+ list_for_each(pos, &packed_git_mru.list) {
+ struct mru *entry = list_entry(pos, struct mru, list);
struct packed_git *p = entry->item;
off_t offset;