From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 1/2] clean up the delta base cache size a bit
Date: Mon, 19 Mar 2007 16:28:51 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.0.83.0703191625090.18328@xanadu.home> (raw)
Currently there are 3 different ways to deal with the cache size.
Let's stick to only one. The compiler is smart enough to produce the exact
same code in those cases anyway.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
sha1_file.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index b0b2177..8a19d7e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1369,7 +1369,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
hash = (unsigned long)p + (unsigned long)base_offset;
hash += (hash >> 8) + (hash >> 16);
- return hash & 0xff;
+ return hash % MAX_DELTA_CACHE;
}
static void *cache_or_unpack_entry(struct packed_git *p, off_t base_offset,
@@ -1417,13 +1417,13 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
release_delta_base_cache(ent);
delta_base_cached += base_size;
for (i = 0; delta_base_cached > delta_base_cache_limit
- && i < ARRAY_SIZE(delta_base_cache); i++) {
+ && i < MAX_DELTA_CACHE ; i++) {
struct delta_base_cache_entry *f = delta_base_cache + i;
if (f->type == OBJ_BLOB)
release_delta_base_cache(f);
}
for (i = 0; delta_base_cached > delta_base_cache_limit
- && i < ARRAY_SIZE(delta_base_cache); i++)
+ && i < MAX_DELTA_CACHE ; i++)
release_delta_base_cache(delta_base_cache + i);
ent->p = p;
--
1.5.1.rc1.596.ge11e-dirty
reply other threads:[~2007-03-19 20:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.0.83.0703191625090.18328@xanadu.home \
--to=nico@cam.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).