Merge branch 'master' of git://git.lttng.org/lttng-tools
[lttng-tools.git] / src / common / hashtable / hashtable.c
index 4f64778df2d31244e319ac81f422fc5ee444339d..8d63e8afffdc60c837514359fe6b9383a27647e9 100644 (file)
@@ -21,8 +21,8 @@
 #include <urcu.h>
 #include <urcu/compiler.h>
 
-#include <common/lttng-share.h>
-#include <common/lttngerr.h>
+#include <common/common.h>
+#include <common/defaults.h>
 
 #include "hashtable.h"
 #include "utils.h"
@@ -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.
  */
This page took 0.024228 seconds and 4 git commands to generate.