X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fhashtable%2Fhashtable.c;h=8d63e8afffdc60c837514359fe6b9383a27647e9;hb=702b1ea4d37c122c2622004fd4cf53175e7c7754;hp=2080107005739f5d4cb61c5f9761a14d7b375998;hpb=4c462e790c62ed5f6c5d61b3a182762fe02f7e9a;p=lttng-tools.git diff --git a/src/common/hashtable/hashtable.c b/src/common/hashtable/hashtable.c index 208010700..8d63e8aff 100644 --- a/src/common/hashtable/hashtable.c +++ b/src/common/hashtable/hashtable.c @@ -199,6 +199,28 @@ void lttng_ht_add_unique_ulong(struct lttng_ht *ht, assert(node_ptr == &node->node); } +/* + * Add replace unsigned long node to hashtable. + */ +struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht, + struct lttng_ht_node_ulong *node) +{ + struct cds_lfht_node *node_ptr; + assert(ht); + assert(ht->ht); + assert(node); + + node_ptr = cds_lfht_add_replace(ht->ht, + ht->hash_fct((void *) node->key, HASH_SEED), ht->match_fct, + (void *) node->key, &node->node); + if (!node_ptr) { + return NULL; + } else { + return caa_container_of(node_ptr, struct lttng_ht_node_ulong, node); + } + assert(node_ptr == &node->node); +} + /* * Delete node from hashtable. */