From 1b4fa050b5e515d4e070cab4050db5116d6859b6 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 2 Mar 2009 11:08:16 -0800 Subject: [PATCH] New macro PORT_ARRAY_FOR_EACH. --- lib/port-array.h | 4 ++++ 1 file changed, 4 insertions(+) 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 */ -- 2.30.2