2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-17 14:28:02 +00:00

svec: New convenience macro SVEC_FOR_EACH.

This commit is contained in:
Ben Pfaff
2009-07-30 13:41:21 -07:00
parent f86e18b739
commit c338e47fbe

View File

@@ -57,4 +57,13 @@ char *svec_join(const struct svec *,
const char *svec_back(const struct svec *);
void svec_pop_back(struct svec *);
/* Iterates over the names in SVEC, assigning each name in turn to NAME and its
* index to INDEX. */
#define SVEC_FOR_EACH(INDEX, NAME, SVEC) \
for ((INDEX) = 0; \
((INDEX) < (SVEC)->n \
? (NAME) = (SVEC)->names[INDEX], 1 \
: 0); \
(INDEX)++)
#endif /* svec.h */