Skip to content

Instantly share code, notes, and snippets.

@5kg
Created November 27, 2013 16:02
Show Gist options
  • Select an option

  • Save 5kg/7678152 to your computer and use it in GitHub Desktop.

Select an option

Save 5kg/7678152 to your computer and use it in GitHub Desktop.
diff --git a/src/common/hashtable/rculfhash.h b/src/common/hashtable/rculfhash.h
index 17cf6db..601feea 100644
--- a/src/common/hashtable/rculfhash.h
+++ b/src/common/hashtable/rculfhash.h
@@ -34,6 +34,11 @@
#include "urcu-flavor.h"
+static int __attribute__((noinline)) __is_null_pointer(unsigned long v)
+{
+ return v == 0;
+}
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -458,7 +463,7 @@ void cds_lfht_resize(struct cds_lfht *ht, unsigned long new_size);
for (cds_lfht_first(ht, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
__typeof__(*(pos)), member); \
- &(pos)->member != NULL; \
+ !__is_null_pointer((unsigned long) &(pos)->member); \
cds_lfht_next(ht, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
__typeof__(*(pos)), member))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment