X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fsvec.h;h=ac2266249ef5192bd0ba93c6f1668d840abb997b;hb=da0603cf278a9f505dc2988602ec0071c771dd2e;hp=7d8777fa8cc5f884a14e09873cb73a034ac6c6cb;hpb=34e63086edddcae06d7c1a4fa84fec0861e50758;p=openvswitch diff --git a/lib/svec.h b/lib/svec.h index 7d8777fa..ac226624 100644 --- a/lib/svec.h +++ b/lib/svec.h @@ -52,9 +52,19 @@ void svec_swap(struct svec *a, struct svec *b); void svec_print(const struct svec *svec, const char *title); void svec_parse_words(struct svec *svec, const char *words); bool svec_equal(const struct svec *, const struct svec *); +void svec_split(struct svec *, const char *s, const char *delimiters); char *svec_join(const struct svec *, const char *delimiter, const char *terminator); 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 */