diff options
| author | Junio C Hamano <gitster@pobox.com> | 2019-07-09 15:25:43 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2019-07-09 15:25:43 -0700 |
| commit | a7db4c193d98f701eda0328dbf69b36f28dd22d3 (patch) | |
| tree | 653e22bcdb1c8bfccb5153426910fa0bfb7d715d /pack-objects.c | |
| parent | Merge branch 'jk/delta-islands-progress-fix' (diff) | |
| parent | hashmap: convert sha1hash() to oidhash() (diff) | |
| download | git-a7db4c193d98f701eda0328dbf69b36f28dd22d3.tar.gz git-a7db4c193d98f701eda0328dbf69b36f28dd22d3.zip | |
Merge branch 'jk/oidhash'
Code clean-up to remove hardcoded SHA-1 hash from many places.
* jk/oidhash:
hashmap: convert sha1hash() to oidhash()
hash.h: move object_id definition from cache.h
khash: rename oid helper functions
khash: drop sha1-specific map types
pack-bitmap: convert khash_sha1 maps into kh_oid_map
delta-islands: convert island_marks khash to use oids
khash: rename kh_oid_t to kh_oid_set
khash: drop broken oid_map typedef
object: convert create_object() to use object_id
object: convert internal hash_obj() to object_id
object: convert lookup_object() to use object_id
object: convert lookup_unknown_object() to use object_id
pack-objects: convert locate_object_entry_hash() to object_id
pack-objects: convert packlist_find() to use object_id
pack-bitmap-write: convert some helpers to use object_id
upload-pack: rename a "sha1" variable to "oid"
describe: fix accidental oid/hash type-punning
Diffstat (limited to 'pack-objects.c')
| -rw-r--r-- | pack-objects.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pack-objects.c b/pack-objects.c index ce33b8906e..52560293b6 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 = oidhash(oid) & 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) @@ -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, &found); if (index_pos) *index_pos = i; |
