Skip to content

Commit 5d0ee3f

Browse files
ttaylorrgitster
authored andcommitted
midx: remove unused midx_locate_pack()
Commit 307d75b (midx: implement `midx_locate_pack()`, 2023-12-14) introduced `midx_locate_pack()`, which was described at the time as a complement to the function `midx_contains_pack()` which allowed callers to determine where in the MIDX lexical order a pack appeared, as opposed to whether or not it was simply contained. 307d75b suggests that future patches would be added which would introduce callers for this new function, but none ever were, meaning the function has gone unused since its introduction. Clean this up by in effect reverting 307d75b, which removes the unused functions and inlines its definition back into `midx_contains_pack()`. (Looking back through the list archives when 307d75b was written, this was in preparation for this[1] patch from back when we had the concept of "disjoint" packs while developing multi-pack verbatim reuse. That concept was abandoned before the series was merged, but I never dropped what would become 307d75b from the series, leading to the state prior to this commit). [1]: https://lore.kernel.org/git/3019738b52ba8cd78ea696a3b800fa91e722eb66.1701198172.git.me@ttaylorr.com/ Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b00e35 commit 5d0ee3f

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

midx.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,7 @@ int cmp_idx_or_pack_name(const char *idx_or_pack_name,
466466
return strcmp(idx_or_pack_name, idx_name);
467467
}
468468

469-
int midx_locate_pack(struct multi_pack_index *m, const char *idx_or_pack_name,
470-
uint32_t *pos)
469+
int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name)
471470
{
472471
uint32_t first = 0, last = m->num_packs;
473472

@@ -478,11 +477,8 @@ int midx_locate_pack(struct multi_pack_index *m, const char *idx_or_pack_name,
478477

479478
current = m->pack_names[mid];
480479
cmp = cmp_idx_or_pack_name(idx_or_pack_name, current);
481-
if (!cmp) {
482-
if (pos)
483-
*pos = mid;
480+
if (!cmp)
484481
return 1;
485-
}
486482
if (cmp > 0) {
487483
first = mid + 1;
488484
continue;
@@ -493,11 +489,6 @@ int midx_locate_pack(struct multi_pack_index *m, const char *idx_or_pack_name,
493489
return 0;
494490
}
495491

496-
int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name)
497-
{
498-
return midx_locate_pack(m, idx_or_pack_name, NULL);
499-
}
500-
501492
int midx_preferred_pack(struct multi_pack_index *m, uint32_t *pack_int_id)
502493
{
503494
if (m->preferred_pack_idx == -1) {

midx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ struct object_id *nth_midxed_object_oid(struct object_id *oid,
102102
int fill_midx_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
103103
int midx_contains_pack(struct multi_pack_index *m,
104104
const char *idx_or_pack_name);
105-
int midx_locate_pack(struct multi_pack_index *m, const char *idx_or_pack_name,
106-
uint32_t *pos);
107105
int midx_preferred_pack(struct multi_pack_index *m, uint32_t *pack_int_id);
108106
int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
109107

0 commit comments

Comments
 (0)