path: root/server-info.c
diff options
authorJeff King <>2019-04-05 18:14:00 (GMT)
committerJunio C Hamano <>2019-04-16 07:58:21 (GMT)
commit79bb8b3c80b902f43d2bc7cdf3afa2ffc2668c32 (patch)
tree7260ea5897976f4962deb376fda3478cff7d7744 /server-info.c
parent4ecbd6492cde3fcf003c387414b3e9983fb2ba4b (diff)
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 <>
Diffstat (limited to 'server-info.c')
1 files changed, 1 insertions, 1 deletions
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)
+ assert(i < num_pack);
info[i] = xcalloc(1, sizeof(struct pack_info));
info[i]->p = p;
info[i]->old_num = -1;