Add support for non unique add string in hashtable
[lttng-tools.git] / src / common / hashtable / hashtable.c
index 263df46839d37af58e2efe66770f5e1833c90f0f..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;
        }
 
@@ -184,7 +185,7 @@ void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node)
 /*
  * Free lttng ht node uint64_t.
  */
-void lttng_ht_node_free_u64(struct lttng_ht_node_ulong *node)
+void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node)
 {
        assert(node);
        free(node);
@@ -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.023851 seconds and 4 git commands to generate.