From efa116c6f19ecdc344a82709e7d919703ec96c45 Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Wed, 28 Aug 2013 14:03:16 -0400 Subject: [PATCH] Add support for non unique add string in hashtable Signed-off-by: Julien Desfossez Signed-off-by: David Goulet --- src/common/hashtable/hashtable.c | 14 ++++++++++++++ src/common/hashtable/hashtable.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/common/hashtable/hashtable.c b/src/common/hashtable/hashtable.c index 8c26ebe15..07210fa81 100644 --- a/src/common/hashtable/hashtable.c +++ b/src/common/hashtable/hashtable.c @@ -220,6 +220,20 @@ void lttng_ht_add_unique_str(struct lttng_ht *ht, assert(node_ptr == &node->node); } +/* + * Add string node to hashtable. + */ +void lttng_ht_add_str(struct lttng_ht *ht, + struct lttng_ht_node_str *node) +{ + assert(ht); + assert(ht->ht); + assert(node); + + cds_lfht_add(ht->ht, ht->hash_fct(node->key, lttng_ht_seed), + &node->node); +} + /* * Add unsigned long node to hashtable. */ diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h index 846c5ec47..4a8a2bd5c 100644 --- a/src/common/hashtable/hashtable.h +++ b/src/common/hashtable/hashtable.h @@ -91,6 +91,8 @@ extern struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong( struct lttng_ht *ht, struct lttng_ht_node_ulong *node); extern struct lttng_ht_node_u64 *lttng_ht_add_replace_u64( struct lttng_ht *ht, struct lttng_ht_node_u64 *node); +extern void lttng_ht_add_str(struct lttng_ht *ht, + struct lttng_ht_node_str *node); extern void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); extern void lttng_ht_add_u64(struct lttng_ht *ht, -- 2.34.1