{"thread":{"id":"7317","subject":"[PATCH 1/2] clean up the delta base cache size a bit","startedAt":"2007-03-19T20:28:51Z","lastAt":"2007-03-19T20:28:51Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"37546","messageId":"alpine.LFD.0.83.0703191625090.18328@xanadu.home","threadId":"7317","inReplyTo":null,"subject":"[PATCH 1/2] clean up the delta base cache size a bit","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-03-19T20:28:51Z","receivedAt":"2007-03-19T20:28:51Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"Currently there are 3 different ways to deal with the cache size.\nLet's stick to only one.  The compiler is smart enough to produce the exact\nsame code in those cases anyway.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n sha1_file.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex b0b2177..8a19d7e 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1369,7 +1369,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)\n \n \thash = (unsigned long)p + (unsigned long)base_offset;\n \thash += (hash >> 8) + (hash >> 16);\n-\treturn hash & 0xff;\n+\treturn hash % MAX_DELTA_CACHE;\n }\n \n static void *cache_or_unpack_entry(struct packed_git *p, off_t base_offset,\n@@ -1417,13 +1417,13 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,\n \trelease_delta_base_cache(ent);\n \tdelta_base_cached += base_size;\n \tfor (i = 0; delta_base_cached > delta_base_cache_limit\n-\t\t&& i < ARRAY_SIZE(delta_base_cache); i++) {\n+\t\t    && i < MAX_DELTA_CACHE ; i++) {\n \t\tstruct delta_base_cache_entry *f = delta_base_cache + i;\n \t\tif (f->type == OBJ_BLOB)\n \t\t\trelease_delta_base_cache(f);\n \t}\n \tfor (i = 0; delta_base_cached > delta_base_cache_limit\n-\t\t&& i < ARRAY_SIZE(delta_base_cache); i++)\n+\t\t    && i < MAX_DELTA_CACHE ; i++)\n \t\trelease_delta_base_cache(delta_base_cache + i);\n \n \tent->p = p;\n-- \n1.5.1.rc1.596.ge11e-dirty\n"}]}