To be used in an upcoming commit.

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/list.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/list.h b/lib/list.h
index 7ba1e35..c1b0891 100644
--- a/lib/list.h
+++ b/lib/list.h
@@ -23,6 +23,11 @@
 #include "util.h"
 #include "openvswitch/list.h"
 
+/* Initializer for a list with pointers that will (probably) cause segfaults if
+ * dereferenced and, better yet, show up clearly in a debugger. */
+#define OVS_LIST_POISON { (void *) (uintptr_t) 0xccccccccccccccccULL, \
+                          (void *) (uintptr_t) 0xccccccccccccccccULL }
+
 static inline void list_init(struct ovs_list *);
 static inline void list_poison(struct ovs_list *);
 
@@ -91,7 +96,7 @@ list_init(struct ovs_list *list)
 static inline void
 list_poison(struct ovs_list *list)
 {
-    memset(list, 0xcc, sizeof *list);
+    *list = (struct ovs_list) OVS_LIST_POISON;
 }
 
 /* Inserts 'elem' just before 'before'. */
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to