ovs-sandbox: Add note about OVN to initial output.
[cascardo/ovs.git] / lib / list.h
index 7ba1e35..f9c9d85 100644 (file)
 #include "util.h"
 #include "openvswitch/list.h"
 
+/* "struct ovs_list" with pointers that will (probably) cause segfaults if
+ * dereferenced and, better yet, show up clearly in a debugger. */
+#define OVS_LIST_POISON \
+(struct ovs_list) { (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL, \
+                    (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL }
+
 static inline void list_init(struct ovs_list *);
 static inline void list_poison(struct ovs_list *);
 
@@ -56,7 +62,7 @@ static inline bool list_is_short(const struct ovs_list *);
          &(ITER)->MEMBER != (LIST);                                     \
          ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER))
 #define LIST_FOR_EACH_CONTINUE(ITER, MEMBER, LIST)                      \
-    for (INIT_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER);             \
+    for (ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER);             \
          &(ITER)->MEMBER != (LIST);                                     \
          ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER))
 #define LIST_FOR_EACH_REVERSE(ITER, MEMBER, LIST)                       \
@@ -91,7 +97,7 @@ list_init(struct ovs_list *list)
 static inline void
 list_poison(struct ovs_list *list)
 {
-    memset(list, 0xcc, sizeof *list);
+    *list = OVS_LIST_POISON;
 }
 
 /* Inserts 'elem' just before 'before'. */