aboutsummaryrefslogtreecommitdiffstats
path: root/oid-array.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-02-10 14:48:31 -0800
committerJunio C Hamano <gitster@pobox.com>2021-02-10 14:48:31 -0800
commit9d5b1c06ac1e46e985b5d62bccb78d9fb6de374a (patch)
treec608df8a6a629c97921530898a40b7ffa52b1a35 /oid-array.c
parentSync with 2.30.1 (diff)
parentoid_pos(): access table through const pointers (diff)
downloadgit-9d5b1c06ac1e46e985b5d62bccb78d9fb6de374a.tar.gz
git-9d5b1c06ac1e46e985b5d62bccb78d9fb6de374a.zip
Merge branch 'jk/use-oid-pos'
Code clean-up to ensure our use of hashtables using object names as keys use the "struct object_id" objects, not the raw hash values. * jk/use-oid-pos: oid_pos(): access table through const pointers hash_pos(): convert to oid_pos() rerere: use strmap to store rerere directories rerere: tighten rr-cache dirname check rerere: check dirname format while iterating rr_cache directory commit_graft_pos(): take an oid instead of a bare hash
Diffstat (limited to 'oid-array.c')
-rw-r--r--oid-array.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/oid-array.c b/oid-array.c
index 889b311f22..73ba76e9e9 100644
--- a/oid-array.c
+++ b/oid-array.c
@@ -22,16 +22,16 @@ void oid_array_sort(struct oid_array *array)
array->sorted = 1;
}
-static const unsigned char *sha1_access(size_t index, void *table)
+static const struct object_id *oid_access(size_t index, const void *table)
{
- struct object_id *array = table;
- return array[index].hash;
+ const struct object_id *array = table;
+ return &array[index];
}
int oid_array_lookup(struct oid_array *array, const struct object_id *oid)
{
oid_array_sort(array);
- return hash_pos(oid->hash, array->oid, array->nr, sha1_access);
+ return oid_pos(oid, array->oid, array->nr, oid_access);
}
void oid_array_clear(struct oid_array *array)