From 79bb8b3c80b902f43d2bc7cdf3afa2ffc2668c32 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 5 Apr 2019 14:14:00 -0400 Subject: server-info: drop nr_alloc struct member We keep an array of struct pointers, with each one representing a single packfile. But for some reason there is a nr_alloc parameter inside each struct, which has never been used. This is probably cruft left over from development, where we might have wanted a nr_alloc to dynamically grow the list. But as it turns out, we do not dynamically grow the list at all, but rather count up the total number of packs and use that as a maximum size. So while we're thinking of this, let's add an assert() that documents (and checks!) that our allocation and fill loops stay in sync. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano diff --git a/server-info.c b/server-info.c index d4115fe..c9fbfd3 100644 --- a/server-info.c +++ b/server-info.c @@ -91,7 +91,6 @@ static struct pack_info { struct packed_git *p; int old_num; int new_num; - int nr_alloc; } **info; static int num_pack; static const char *objdir; @@ -213,6 +212,7 @@ static void init_pack_info(const char *infofile, int force) for (i = 0, p = get_all_packs(the_repository); p; p = p->next) { if (!p->pack_local) continue; + assert(i < num_pack); info[i] = xcalloc(1, sizeof(struct pack_info)); info[i]->p = p; info[i]->old_num = -1; -- cgit v0.10.2-6-g49f6