From: Ben Pfaff Date: Mon, 2 Mar 2009 19:08:16 +0000 (-0800) Subject: New macro PORT_ARRAY_FOR_EACH. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b4fa050b5e515d4e070cab4050db5116d6859b6;p=openvswitch New macro PORT_ARRAY_FOR_EACH. --- diff --git a/lib/port-array.h b/lib/port-array.h index 1522fccb..4b95e837 100644 --- a/lib/port-array.h +++ b/lib/port-array.h @@ -105,4 +105,8 @@ void *port_array_first(const struct port_array *, unsigned int *); void *port_array_next(const struct port_array *, unsigned int *); unsigned int port_array_count(const struct port_array *); +#define PORT_ARRAY_FOR_EACH(DATA, ARRAY, PORT_NO) \ + for ((DATA) = port_array_first(ARRAY, &(PORT_NO)); (DATA) != NULL; \ + (DATA) = port_array_next(ARRAY, &(PORT_NO))) + #endif /* port-array.h */