From: Mathieu Desnoyers Date: Thu, 7 Jul 2011 15:13:06 +0000 (-0400) Subject: rculfhash: fix add unique X-Git-Tag: v0.7.0~43^2~212 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e43f23f80fca2d7c3e5ae1b412649fdf20bb8f9c;p=urcu.git rculfhash: fix add unique Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index 11c0077..1ccd3f1 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -262,6 +262,12 @@ int _ht_add(struct rcu_ht *ht, struct rcu_table *t, struct rcu_ht_node *node, next = rcu_dereference(clear_flag(iter)->next); if (is_removed(next)) goto gc_node; + if (unique + && !clear_flag(iter)->dummy + && !ht->compare_fct(node->key, node->key_len, + clear_flag(iter)->key, + clear_flag(iter)->key_len)) + return -EEXIST; /* Only account for identical reverse hash once */ if (iter_prev->reverse_hash != clear_flag(iter)->reverse_hash) check_resize(ht, t, ++chain_len);