projects
/
openvswitch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f86e18b
)
svec: New convenience macro SVEC_FOR_EACH.
author
Ben Pfaff
<blp@nicira.com>
Thu, 30 Jul 2009 20:41:21 +0000
(13:41 -0700)
committer
Ben Pfaff
<blp@nicira.com>
Fri, 7 Aug 2009 22:05:47 +0000
(15:05 -0700)
lib/svec.h
patch
|
blob
|
history
diff --git
a/lib/svec.h
b/lib/svec.h
index 7d8777fa8cc5f884a14e09873cb73a034ac6c6cb..e1736bc6c399b5932265ee12c18d65f055443507 100644
(file)
--- a/
lib/svec.h
+++ b/
lib/svec.h
@@
-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 */