#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 *);
&(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) \
static inline void
list_poison(struct ovs_list *list)
{
- memset(list, 0xcc, sizeof *list);
+ *list = OVS_LIST_POISON;
}
/* Inserts 'elem' just before 'before'. */