pack-objects: convert locate_object_entry_hash() to object_id
There are no callers of locate_object_entry_hash() that aren't just passing us the "hash" member of a "struct object_id". Let's take the whole struct, which gets us closer to removing all raw sha1 variables. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 20, 2019 at 03:41 UTC
5e7ac6802823ec23759b1b986315bd65b0881ff9
1 file changed
+5
-5
pack-objects.c
+5
-5
@@ -6,17 +6,17 @@
6
#include "config.h"
7
8
static uint32_t locate_object_entry_hash(struct packing_data *pdata,
9
- const unsigned char *sha1,
9
+ const struct object_id *oid,
10
int *found)
11
{
12
uint32_t i, mask = (pdata->index_size - 1);
13
14
- i = sha1hash(sha1) & mask;
14
+ i = sha1hash(oid->hash) & mask;
15
16
while (pdata->index[i] > 0) {
17
uint32_t pos = pdata->index[i] - 1;
18
19
- if (hasheq(sha1, pdata->objects[pos].idx.oid.hash)) {
19
+ if (oideq(oid, &pdata->objects[pos].idx.oid)) {
20
*found = 1;
21
return i;
22
}
@@ -56,7 +56,7 @@ static void rehash_objects(struct packing_data *pdata)
56
for (i = 0; i < pdata->nr_objects; i++) {
57
int found;
58
uint32_t ix = locate_object_entry_hash(pdata,
59
- entry->idx.oid.hash,
59
+ &entry->idx.oid,
60
&found);
61
62
if (found)
@@ -77,7 +77,7 @@ struct object_entry *packlist_find(struct packing_data *pdata,
77
if (!pdata->index_size)
78
return NULL;
79
80
- i = locate_object_entry_hash(pdata, oid->hash, &found);
80
+ i = locate_object_entry_hash(pdata, oid, &found);
81
82
if (index_pos)
83
*index_pos = i;