pack-bitmap: switch hard-coded constants to the_hash_algo
Switch two hard-coded uses of 20 to references to the_hash_algo. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Feb 19, 2019 at 00:04 UTC
9941e920e0b5a79c5b7859cb59b9ab866a77b25f
1 file changed
+2
-2
pack-bitmap.c
+2
-2
@@ -138,7 +138,7 @@ static int load_bitmap_header(struct bitmap_index *index)
138
{
139
struct bitmap_disk_header *header = (void *)index->map;
140
141
- if (index->map_size < sizeof(*header) + 20)
141
+ if (index->map_size < sizeof(*header) + the_hash_algo->rawsz)
142
return error("Corrupted bitmap index (missing header data)");
143
144
if (memcmp(header->magic, BITMAP_IDX_SIGNATURE, sizeof(BITMAP_IDX_SIGNATURE)) != 0)
@@ -157,7 +157,7 @@ static int load_bitmap_header(struct bitmap_index *index)
157
"(Git requires BITMAP_OPT_FULL_DAG)");
158
159
if (flags & BITMAP_OPT_HASH_CACHE) {
160
- unsigned char *end = index->map + index->map_size - 20;
160
+ unsigned char *end = index->map + index->map_size - the_hash_algo->rawsz;
161
index->hashes = ((uint32_t *)end) - index->pack->num_objects;
162
}
163
}