diff --git a/common/array.h b/common/array.h index fcda00d9c..394790170 100644 --- a/common/array.h +++ b/common/array.h @@ -30,6 +30,11 @@ int len, size; \ } pfx##_array_t; +#define foreach(var, array) \ + for(typeof((array).tab) var = (array).tab; \ + var < (array).tab + (array).len; \ + var++) + #define ARRAY_FUNCS(type_t, pfx, dtor) \ static inline pfx##_array_t * pfx##_array_new(void) { \ return p_new(pfx##_array_t, 1); \