midx: inline the `MIDX_MIN_SIZE` definition

The `MIDX_MIN_SIZE` definition is used to check the midx_size in `local_multi_pack_index_one`. This definition relies on the `the_hash_algo` global variable. Inline this and remove the global variable usage. With this, remove `USE_THE_REPOSITORY_VARIABLE` usage from `midx.c`. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Karthik Nayak committed Nov 27, 2024 at 17:28 UTC 24d3dd79e4810ae7bafb3180664ac435fecd567f
1 file changed +1 -5
midx.c
+1 -5
@@ -1,5 +1,3 @@
1 -#define USE_THE_REPOSITORY_VARIABLE
2 -
1 #include "git-compat-util.h"
2 #include "config.h"
3 #include "dir.h"
@@ -94,8 +92,6 @@ static int midx_read_object_offsets(const unsigned char *chunk_start,
92 return 0;
93 }
94
97 -#define MIDX_MIN_SIZE (MIDX_HEADER_SIZE + the_hash_algo->rawsz)
98 -
95 static struct multi_pack_index *load_multi_pack_index_one(struct repository *r,
96 const char *object_dir,
97 const char *midx_name,
@@ -122,7 +118,7 @@ static struct multi_pack_index *load_multi_pack_index_one(struct repository *r,
118
119 midx_size = xsize_t(st.st_size);
120
125 - if (midx_size < MIDX_MIN_SIZE) {
121 + if (midx_size < (MIDX_HEADER_SIZE + r->hash_algo->rawsz)) {
122 error(_("multi-pack-index file %s is too small"), midx_name);
123 goto cleanup_fail;
124 }