Make temporary variable in _rcu_dereference non-const
[urcu.git] / include / urcu / rculfhash.h
index 292fc0d9fc9c0fadcdd370864fe6ca249140a298..29dd88f1f16b0ea320ffa82ef2ed0596c7aaba65 100644 (file)
@@ -27,6 +27,7 @@
  * _after_ including your URCU flavor.
  */
 
+#include <urcu/config.h>
 #include <stdint.h>
 #include <pthread.h>
 #include <urcu/compiler.h>
@@ -35,6 +36,8 @@
 extern "C" {
 #endif
 
+struct cds_lfht;
+
 /*
  * cds_lfht_node: Contains the next pointers and reverse-hash
  * value required for lookup and traversal of the hash table.
@@ -65,6 +68,18 @@ struct cds_lfht_node {
 /* cds_lfht_iter: Used to track state while traversing a hash chain. */
 struct cds_lfht_iter {
        struct cds_lfht_node *node, *next;
+       /*
+        * For debugging purposes, build both API users and rculfhash
+        * library with CDS_LFHT_ITER_DEBUG defined. This enables extra
+        * consistency checks for calls to a cds_lfht_next() or
+        * cds_lfht_next_duplicate() after the iterator has been
+        * re-purposed to iterate on a different hash table. This is a
+        * common programming mistake when performing hash table lookup
+        * nested in a hash table traversal.
+        */
+#ifdef CONFIG_CDS_LFHT_ITER_DEBUG
+       struct cds_lfht *lfht;
+#endif
 };
 
 static inline
@@ -73,7 +88,6 @@ struct cds_lfht_node *cds_lfht_iter_get_node(struct cds_lfht_iter *iter)
        return iter->node;
 }
 
-struct cds_lfht;
 struct rcu_flavor_struct;
 
 /*
@@ -91,7 +105,7 @@ typedef int (*cds_lfht_match_fct)(struct cds_lfht_node *node, const void *key);
  * (detection of memory corruption).
  */
 static inline
-void cds_lfht_node_init(struct cds_lfht_node *node)
+void cds_lfht_node_init(struct cds_lfht_node *node __attribute__((unused)))
 {
 }
 
@@ -485,7 +499,7 @@ int cds_lfht_del(struct cds_lfht *ht, struct cds_lfht_node *node);
  * This function does not issue any memory barrier.
  */
 extern
-int cds_lfht_is_node_deleted(struct cds_lfht_node *node);
+int cds_lfht_is_node_deleted(const struct cds_lfht_node *node);
 
 /*
  * cds_lfht_resize - Force a hash table resize
This page took 0.023015 seconds and 4 git commands to generate.