summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Gargi Sharma <gs051095@gmail.com>2018-01-23 18:46:51 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-01-24 09:52:16 -0800
commitec2dd32c705f43ef133a54cee99426c44eb3ab88 (patch)
tree31dbbe1fe450167adf4575f1128f3e01de7da26d /builtin
parentmru: use double-linked list from list.h (diff)
downloadtgif-ec2dd32c705f43ef133a54cee99426c44eb3ab88.tar.xz
mru: Replace mru.[ch] with list.h implementation
Replace the custom calls to mru.[ch] with calls to list.h. This patch is the final step in removing the mru API completely and inlining the logic. This patch leads to significant code reduction and the mru API hence, is not a useful abstraction anymore. Signed-off-by: Gargi Sharma <gs051095@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/pack-objects.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index ba812349e0..6a0b8e8b9c 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -24,7 +24,7 @@
#include "reachable.h"
#include "sha1-array.h"
#include "argv-array.h"
-#include "mru.h"
+#include "list.h"
#include "packfile.h"
static const char *pack_usage[] = {
@@ -1012,9 +1012,8 @@ static int want_object_in_pack(const unsigned char *sha1,
return want;
}
- list_for_each(pos, &packed_git_mru.list) {
- struct mru *entry = list_entry(pos, struct mru, list);
- struct packed_git *p = entry->item;
+ list_for_each(pos, &packed_git_mru) {
+ struct packed_git *p = list_entry(pos, struct packed_git, mru);
off_t offset;
if (p == *found_pack)
@@ -1031,7 +1030,7 @@ static int want_object_in_pack(const unsigned char *sha1,
}
want = want_found_object(exclude, p);
if (!exclude && want > 0)
- mru_mark(&packed_git_mru, entry);
+ list_move(&p->mru, &packed_git_mru);
if (want != -1)
return want;
}