summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-13 21:39:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-13 21:39:05 (GMT)
commitafc8aa3fbf249cfc2f75c7586b9d32f172ab97a1 (patch)
tree9e094f4c5032333ff27eadd42a3b6040aa3473a7 /packfile.c
parent6bed209a20a06f2d6b7142216dabff456de798e1 (diff)
parent8865859dfc346c61f0e75fa429c5d307bd27368c (diff)
downloadgit-afc8aa3fbf249cfc2f75c7586b9d32f172ab97a1.zip
git-afc8aa3fbf249cfc2f75c7586b9d32f172ab97a1.tar.gz
git-afc8aa3fbf249cfc2f75c7586b9d32f172ab97a1.tar.bz2
Merge branch 'ot/mru-on-list'
The first step to getting rid of mru API and using the doubly-linked list API directly instead. * ot/mru-on-list: mru: use double-linked list from list.h
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/packfile.c b/packfile.c
index 234797c..f4dc4a2 100644
--- a/packfile.c
+++ b/packfile.c
@@ -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;
+struct mru packed_git_mru = {{&packed_git_mru.list, &packed_git_mru.list}};
#define SZ_FMT PRIuMAX
static inline uintmax_t sz_fmt(size_t s) { return s; }
@@ -1841,13 +1841,14 @@ static int fill_pack_entry(const unsigned char *sha1,
*/
int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
{
- struct mru_entry *p;
+ struct list_head *pos;
prepare_packed_git();
if (!packed_git)
return 0;
- for (p = packed_git_mru.head; p; p = p->next) {
+ 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);
return 1;