@matheusbsbs / matheus-bagliano / commits / 3358004a00
Fork 0

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>

Nicolas Pitre committed Mar 19, 2007 at 16:28 UTC 3358004a006714477c2c44577507081cb5124fa4
1 file changed +3 -3
sha1_file.c
+3 -3
@@ -1369,7 +1369,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
1369
1370 hash = (unsigned long)p + (unsigned long)base_offset;
1371 hash += (hash >> 8) + (hash >> 16);
1372 - return hash & 0xff;
1372 + return hash % MAX_DELTA_CACHE;
1373 }
1374
1375 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,
1417 release_delta_base_cache(ent);
1418 delta_base_cached += base_size;
1419 for (i = 0; delta_base_cached > delta_base_cache_limit
1420 - && i < ARRAY_SIZE(delta_base_cache); i++) {
1420 + && i < MAX_DELTA_CACHE ; i++) {
1421 struct delta_base_cache_entry *f = delta_base_cache + i;
1422 if (f->type == OBJ_BLOB)
1423 release_delta_base_cache(f);
1424 }
1425 for (i = 0; delta_base_cached > delta_base_cache_limit
1426 - && i < ARRAY_SIZE(delta_base_cache); i++)
1426 + && i < MAX_DELTA_CACHE ; i++)
1427 release_delta_base_cache(delta_base_cache + i);
1428
1429 ent->p = p;