summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-13 21:39:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-13 21:39:06 (GMT)
commit867622398f7e7a8a7c6e7a5418e7cbdcffc44d02 (patch)
tree7e42f2fe39327130caa1fdbfc221b85b8cb3a163 /packfile.c
parentafc8aa3fbf249cfc2f75c7586b9d32f172ab97a1 (diff)
parentec2dd32c705f43ef133a54cee99426c44eb3ab88 (diff)
downloadgit-867622398f7e7a8a7c6e7a5418e7cbdcffc44d02.zip
git-867622398f7e7a8a7c6e7a5418e7cbdcffc44d02.tar.gz
git-867622398f7e7a8a7c6e7a5418e7cbdcffc44d02.tar.bz2
Merge branch 'gs/retire-mru'
Retire mru API as it does not give enough abstraction over underlying list API to be worth it. * gs/retire-mru: mru: Replace mru.[ch] with list.h implementation
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/packfile.c b/packfile.c
index f4dc4a2..2d5774d 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1,5 +1,5 @@
#include "cache.h"
-#include "mru.h"
+#include "list.h"
#include "pack.h"
#include "dir.h"
#include "mergesort.h"
@@ -45,7 +45,7 @@ static unsigned int pack_max_fds;
static size_t peak_pack_mapped;
static size_t pack_mapped;
struct packed_git *packed_git;
-struct mru packed_git_mru = {{&packed_git_mru.list, &packed_git_mru.list}};
+LIST_HEAD(packed_git_mru);
#define SZ_FMT PRIuMAX
static inline uintmax_t sz_fmt(size_t s) { return s; }
@@ -876,9 +876,10 @@ static void prepare_packed_git_mru(void)
{
struct packed_git *p;
- mru_clear(&packed_git_mru);
+ INIT_LIST_HEAD(&packed_git_mru);
+
for (p = packed_git; p; p = p->next)
- mru_append(&packed_git_mru, p);
+ list_add_tail(&p->mru, &packed_git_mru);
}
static int prepare_packed_git_run_once = 0;
@@ -1847,10 +1848,10 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
if (!packed_git)
return 0;
- list_for_each(pos, &packed_git_mru.list) {
- struct mru *p = list_entry(pos, struct mru, list);
- if (fill_pack_entry(sha1, e, p->item)) {
- mru_mark(&packed_git_mru, p);
+ list_for_each(pos, &packed_git_mru) {
+ struct packed_git *p = list_entry(pos, struct packed_git, mru);
+ if (fill_pack_entry(sha1, e, p)) {
+ list_move(&p->mru, &packed_git_mru);
return 1;
}
}