aboutsummaryrefslogtreecommitdiff
path: root/tests/qht-bench.c
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2017-07-11 18:48:21 -0400
committerRichard Henderson <richard.henderson@linaro.org>2018-06-15 07:42:55 -1000
commit32359d529f30bea8124ed671b2e6a22f22540488 (patch)
tree937ee3f60e999574e764bcbf29f4aab1960cfe5b /tests/qht-bench.c
parent61b8cef1d42567d3029e0c7180cbd0f16cc4be2d (diff)
downloadqemu-32359d529f30bea8124ed671b2e6a22f22540488.zip
qemu-32359d529f30bea8124ed671b2e6a22f22540488.tar.gz
qemu-32359d529f30bea8124ed671b2e6a22f22540488.tar.bz2
qht: return existing entry when qht_insert fails
The meaning of "existing" is now changed to "matches in hash and ht->cmp result". This is saner than just checking the pointer value. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/qht-bench.c')
-rw-r--r--tests/qht-bench.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/qht-bench.c b/tests/qht-bench.c
index c94ac25..f492b3a 100644
--- a/tests/qht-bench.c
+++ b/tests/qht-bench.c
@@ -163,7 +163,7 @@ static void do_rw(struct thread_info *info)
bool written = false;
if (qht_lookup(&ht, p, hash) == NULL) {
- written = qht_insert(&ht, p, hash);
+ written = qht_insert(&ht, p, hash, NULL);
}
if (written) {
stats->in++;
@@ -322,7 +322,7 @@ static void htable_init(void)
r = xorshift64star(r);
p = &keys[r & (init_range - 1)];
hash = h(*p);
- if (qht_insert(&ht, p, hash)) {
+ if (qht_insert(&ht, p, hash, NULL)) {
break;
}
retries++;