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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2019-04-05 14:14:00 -04:00 committed by Junio C Hamano
parent 4ecbd6492c
commit 79bb8b3c80

View file

@ -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;