diff options
author | Nicolas Pitre <nico@cam.org> | 2007-03-19 16:28:51 -0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-03-19 18:15:59 -0700 |
commit | 3358004a006714477c2c44577507081cb5124fa4 (patch) | |
tree | 206e20594baa026cde33b0ed41e2fe4799aa5755 /sha1_file.c | |
parent | ceb8442af7367611c3f5db124a5dc1dbb7fb438f (diff) | |
download | git-3358004a006714477c2c44577507081cb5124fa4.tar.gz |
clean up the delta base cache size a bit
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sha1_file.c b/sha1_file.c index b0b21776e7..8a19d7ee29 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; |