Skip to content

Commit 870e227

Browse files
committed
Merge branch 'jk/midx-unused-fix'
Code clean-up in the base topic. * jk/midx-unused-fix: midx: drop unused parameters from add_midx_to_chain()
2 parents bb9c16b + 1784522 commit 870e227

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

midx.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ static int open_multi_pack_index_chain(const char *chain_file,
264264
}
265265

266266
static int add_midx_to_chain(struct multi_pack_index *midx,
267-
struct multi_pack_index *midx_chain,
268-
struct object_id *oids,
269-
int n)
267+
struct multi_pack_index *midx_chain)
270268
{
271269
if (midx_chain) {
272270
if (unsigned_add_overflows(midx_chain->num_packs,
@@ -300,21 +298,20 @@ static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
300298
{
301299
struct multi_pack_index *midx_chain = NULL;
302300
struct strbuf buf = STRBUF_INIT;
303-
struct object_id *layers = NULL;
304301
int valid = 1;
305302
uint32_t i, count;
306303
FILE *fp = xfdopen(fd, "r");
307304

308305
count = st->st_size / (the_hash_algo->hexsz + 1);
309-
CALLOC_ARRAY(layers, count);
310306

311307
for (i = 0; i < count; i++) {
312308
struct multi_pack_index *m;
309+
struct object_id layer;
313310

314311
if (strbuf_getline_lf(&buf, fp) == EOF)
315312
break;
316313

317-
if (get_oid_hex(buf.buf, &layers[i])) {
314+
if (get_oid_hex(buf.buf, &layer)) {
318315
warning(_("invalid multi-pack-index chain: line '%s' "
319316
"not a hash"),
320317
buf.buf);
@@ -325,12 +322,12 @@ static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
325322
valid = 0;
326323

327324
strbuf_reset(&buf);
328-
get_split_midx_filename_ext(&buf, object_dir, layers[i].hash,
325+
get_split_midx_filename_ext(&buf, object_dir, layer.hash,
329326
MIDX_EXT_MIDX);
330327
m = load_multi_pack_index_one(object_dir, buf.buf, local);
331328

332329
if (m) {
333-
if (add_midx_to_chain(m, midx_chain, layers, i)) {
330+
if (add_midx_to_chain(m, midx_chain)) {
334331
midx_chain = m;
335332
valid = 1;
336333
} else {
@@ -343,7 +340,6 @@ static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
343340
}
344341
}
345342

346-
free(layers);
347343
fclose(fp);
348344
strbuf_release(&buf);
349345

0 commit comments

Comments
 (0)