summaryrefslogtreecommitdiff
path: root/oidmap.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-09-17 20:53:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-17 20:53:57 (GMT)
commit769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3 (patch)
tree524c7d9759fb9deae7b82581aa28fc8bc38265f6 /oidmap.c
parentd88949d86eddb62acbc85c16c97587db043d05b1 (diff)
parentd9f62dfa0ddc31bdad93054acca9fd42ca781f7f (diff)
downloadgit-769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3.zip
git-769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3.tar.gz
git-769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3.tar.bz2
Merge branch 'jk/cocci'
spatch transformation to replace boolean uses of !hashcmp() to newly introduced oideq() is added, and applied, to regain performance lost due to support of multiple hash algorithms. * jk/cocci: show_dirstat: simplify same-content check read-cache: use oideq() in ce_compare functions convert hashmap comparison functions to oideq() convert "hashcmp() != 0" to "!hasheq()" convert "oidcmp() != 0" to "!oideq()" convert "hashcmp() == 0" to hasheq() convert "oidcmp() == 0" to oideq() introduce hasheq() and oideq() coccinelle: use <...> for function exclusion
Diffstat (limited to 'oidmap.c')
-rw-r--r--oidmap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/oidmap.c b/oidmap.c
index d9fb19b..b0841a0 100644
--- a/oidmap.c
+++ b/oidmap.c
@@ -1,14 +1,14 @@
#include "cache.h"
#include "oidmap.h"
-static int cmpfn(const void *hashmap_cmp_fn_data,
- const void *entry, const void *entry_or_key,
- const void *keydata)
+static int oidmap_neq(const void *hashmap_cmp_fn_data,
+ const void *entry, const void *entry_or_key,
+ const void *keydata)
{
const struct oidmap_entry *entry_ = entry;
if (keydata)
- return oidcmp(&entry_->oid, (const struct object_id *) keydata);
- return oidcmp(&entry_->oid,
+ return !oideq(&entry_->oid, (const struct object_id *) keydata);
+ return !oideq(&entry_->oid,
&((const struct oidmap_entry *) entry_or_key)->oid);
}
@@ -21,7 +21,7 @@ static int hash(const struct object_id *oid)
void oidmap_init(struct oidmap *map, size_t initial_size)
{
- hashmap_init(&map->map, cmpfn, NULL, initial_size);
+ hashmap_init(&map->map, oidmap_neq, NULL, initial_size);
}
void oidmap_free(struct oidmap *map, int free_entries)