Skip to content

Commit

Permalink
list: New macro OVS_LIST_POISON for initializing a poisoned list.
Browse files Browse the repository at this point in the history
To be used in an upcoming commit.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
blp committed Jul 31, 2015
1 parent e467ea4 commit 7b71784
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#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) { (void *) (uintptr_t) 0xccccccccccccccccULL, \
(void *) (uintptr_t) 0xccccccccccccccccULL }

static inline void list_init(struct ovs_list *);
static inline void list_poison(struct ovs_list *);

Expand Down Expand Up @@ -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'. */
Expand Down

0 comments on commit 7b71784

Please sign in to comment.