On Fri, Jul 31, 2015 at 11:18:22AM -0700, Jarno Rajahalme wrote: > One question below,
One answer below ;-) > Acked-by: Jarno Rajahalme <jrajaha...@nicira.com> Thanks. > > On Jul 29, 2015, at 11:42 PM, Ben Pfaff <b...@nicira.com> wrote: > > > > 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; > > Could the cast be part of the macro? The short answer is "yes". Would you like it that way, then? For C pedants only, continue reading for pedantry below the fold. --8<--------------------------cut here-------------------------->8-- First, it's not a cast. It's a compound literal, and the C standard says, in a footnote: "Note that [a compound literal] differs from a cast expression. For example, a cast specifies a conversion to scalar types or void only, and the result of a cast expression is not an lvalue." Second, a compound literal isn't an initializer (except in the degenerate sense that any expression is an initializer). The {...} bracketed text in OVS_LIST_POISON is really an initializer. So I'd probably update the comment above OVS_LIST_POISON at the same time, for better pedantry. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev