~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to lib/sset.h

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
/* Iteration macros. */
71
71
#define SSET_FOR_EACH(NAME, SSET)               \
72
72
    for ((NAME) = SSET_FIRST(SSET);             \
73
 
         SSET_NODE_FROM_NAME(NAME) != NULL;     \
 
73
         NAME != NULL;                          \
74
74
         (NAME) = SSET_NEXT(SSET, NAME))
75
75
 
76
76
#define SSET_FOR_EACH_SAFE(NAME, NEXT, SSET)        \
77
77
    for ((NAME) = SSET_FIRST(SSET);                 \
78
 
         (SSET_NODE_FROM_NAME(NAME) != NULL         \
 
78
         (NAME != NULL                              \
79
79
          ? (NEXT) = SSET_NEXT(SSET, NAME), true    \
80
80
          : false);                                 \
81
81
         (NAME) = (NEXT))
87
87
#define SSET_NODE_FROM_HMAP_NODE(HMAP_NODE) \
88
88
    CONTAINER_OF(HMAP_NODE, struct sset_node, hmap_node)
89
89
#define SSET_NAME_FROM_HMAP_NODE(HMAP_NODE) \
90
 
    (CONST_CAST(const char *, (SSET_NODE_FROM_HMAP_NODE(HMAP_NODE)->name)))
 
90
    HMAP_NODE == NULL                       \
 
91
    ? NULL                                  \
 
92
    : (CONST_CAST(const char *, (SSET_NODE_FROM_HMAP_NODE(HMAP_NODE)->name)))
91
93
#define SSET_NODE_FROM_NAME(NAME) CONTAINER_OF(NAME, struct sset_node, name)
92
94
#define SSET_FIRST(SSET) SSET_NAME_FROM_HMAP_NODE(hmap_first(&(SSET)->map))
93
95
#define SSET_NEXT(SSET, NAME)                                           \