From 3df28caefb2193fb7bbc87a427a620d96d508c8d Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 20 Jun 2019 03:41:03 -0400 Subject: pack-objects: convert packlist_find() to use object_id We take a raw hash pointer, but most of our callers have a "struct object_id" already. Let's switch to taking the full struct, which will let us continue removing uses of raw sha1 buffers. There are two callers that do need special attention: - in rebuild_existing_bitmaps(), we need to switch to nth_packed_object_oid(). This incurs an extra hash copy over pointing straight to the mmap'd sha1, but it shouldn't be measurable compared to the rest of the operation. - in can_reuse_delta() we already spent the effort to copy the sha1 into a "struct object_id", but now we just have to do so a little earlier in the function (we can't easily convert that function's callers because they may be pointing at mmap'd REF_DELTA blocks). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- pack-objects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pack-objects.c') diff --git a/pack-objects.c b/pack-objects.c index ce33b8906e..49fdf52ea6 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -68,7 +68,7 @@ static void rehash_objects(struct packing_data *pdata) } struct object_entry *packlist_find(struct packing_data *pdata, - const unsigned char *sha1, + const struct object_id *oid, uint32_t *index_pos) { uint32_t i; @@ -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, sha1, &found); + i = locate_object_entry_hash(pdata, oid->hash, &found); if (index_pos) *index_pos = i; -- cgit v1.2.1