X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fsvec.h;h=e1736bc6c399b5932265ee12c18d65f055443507;hb=378e1f9854e5bee378ff05a26906a45d1673ab7a;hp=7d8777fa8cc5f884a14e09873cb73a034ac6c6cb;hpb=a14bc59fb8f27db193d74662dc9c5cb8237177ef;p=openvswitch diff --git a/lib/svec.h b/lib/svec.h index 7d8777fa..e1736bc6 100644 --- 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 */