summaryrefslogtreecommitdiff
path: root/pack-objects.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-06-20 07:41:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-20 17:03:32 (GMT)
commit5e7ac6802823ec23759b1b986315bd65b0881ff9 (patch)
tree0df3a817475a36bc160628d4c87282a9c20365c1 /pack-objects.c
parent3df28caefb2193fb7bbc87a427a620d96d508c8d (diff)
downloadgit-5e7ac6802823ec23759b1b986315bd65b0881ff9.zip
git-5e7ac6802823ec23759b1b986315bd65b0881ff9.tar.gz
git-5e7ac6802823ec23759b1b986315bd65b0881ff9.tar.bz2
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>
Diffstat (limited to 'pack-objects.c')
-rw-r--r--pack-objects.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/pack-objects.c b/pack-objects.c
index 49fdf52..00a5f6e 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -6,17 +6,17 @@
#include "config.h"
static uint32_t locate_object_entry_hash(struct packing_data *pdata,
- const unsigned char *sha1,
+ const struct object_id *oid,
int *found)
{
uint32_t i, mask = (pdata->index_size - 1);
- i = sha1hash(sha1) & mask;
+ i = sha1hash(oid->hash) & mask;
while (pdata->index[i] > 0) {
uint32_t pos = pdata->index[i] - 1;
- if (hasheq(sha1, pdata->objects[pos].idx.oid.hash)) {
+ if (oideq(oid, &pdata->objects[pos].idx.oid)) {
*found = 1;
return i;
}
@@ -56,7 +56,7 @@ static void rehash_objects(struct packing_data *pdata)
for (i = 0; i < pdata->nr_objects; i++) {
int found;
uint32_t ix = locate_object_entry_hash(pdata,
- entry->idx.oid.hash,
+ &entry->idx.oid,
&found);
if (found)
@@ -77,7 +77,7 @@ struct object_entry *packlist_find(struct packing_data *pdata,
if (!pdata->index_size)
return NULL;
- i = locate_object_entry_hash(pdata, oid->hash, &found);
+ i = locate_object_entry_hash(pdata, oid, &found);
if (index_pos)
*index_pos = i;