Add support for non unique add string in hashtable
[lttng-tools.git] / src / common / hashtable / hashtable.c
index 30bed07df6b6331cb2dbb18c169a2755a2e0f27b..07210fa8161e63e41a6ea12c061812b27c94d1c8 100644 (file)
@@ -105,6 +105,7 @@ struct lttng_ht *lttng_ht_new(unsigned long size, int type)
                break;
        default:
                ERR("Unknown lttng hashtable type %d", type);
+               lttng_ht_destroy(ht);
                goto error;
        }
 
@@ -219,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.
  */
This page took 0.022989 seconds and 4 git commands to generate.