Skip to content

Commit 36a7b11

Browse files
KarthikNayakgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e9b91ea commit 36a7b11

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

midx.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define USE_THE_REPOSITORY_VARIABLE
2-
31
#include "git-compat-util.h"
42
#include "config.h"
53
#include "dir.h"
@@ -94,8 +92,6 @@ static int midx_read_object_offsets(const unsigned char *chunk_start,
9492
return 0;
9593
}
9694

97-
#define MIDX_MIN_SIZE (MIDX_HEADER_SIZE + the_hash_algo->rawsz)
98-
9995
static struct multi_pack_index *load_multi_pack_index_one(struct repository *r,
10096
const char *object_dir,
10197
const char *midx_name,
@@ -122,7 +118,7 @@ static struct multi_pack_index *load_multi_pack_index_one(struct repository *r,
122118

123119
midx_size = xsize_t(st.st_size);
124120

125-
if (midx_size < MIDX_MIN_SIZE) {
121+
if (midx_size < (MIDX_HEADER_SIZE + r->hash_algo->rawsz)) {
126122
error(_("multi-pack-index file %s is too small"), midx_name);
127123
goto cleanup_fail;
128124
}

0 commit comments

Comments
 (0)