diff options
author | Ben Pfaff <blp@nicira.com> | 2015-07-31 13:14:20 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2015-07-31 13:14:20 -0700 |
commit | 7b71784429099e69870a9d6a3fc7ef7de8ca9cb0 (patch) | |
tree | 4d2fee77a7265b52e5bdc8c3b1f682510d60ef64 /lib/list.h | |
parent | e467ea42c4b2b98e4b106cbb651db2699ca127d6 (diff) | |
download | openvswitch-7b71784429099e69870a9d6a3fc7ef7de8ca9cb0.tar.gz |
list: New macro OVS_LIST_POISON for initializing a poisoned list.
To be used in an upcoming commit.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Diffstat (limited to 'lib/list.h')
-rw-r--r-- | lib/list.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/list.h b/lib/list.h index 7ba1e3549..5ad54b8eb 100644 --- a/lib/list.h +++ b/lib/list.h @@ -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 *); @@ -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'. */ |