diff options
author | Damjan Marion <damarion@cisco.com> | 2023-08-06 20:41:40 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-08-07 17:33:25 +0000 |
commit | 993735913c6764d7a66c8fae4196a61206611186 (patch) | |
tree | d5636b701ed42288a5c9ec666c67f2d0b247a0de /src/vppinfra/vec_bootstrap.h | |
parent | 8d0c0c68215a2972053ba7fd8fa0f82aa14f8624 (diff) |
vppinfra: add vec_foreach_pointer macro
works with vectors of pointers...
Type: improvement
Change-Id: I530653978fcf981be299cf42a1133be000d74d0c
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vec_bootstrap.h')
-rw-r--r-- | src/vppinfra/vec_bootstrap.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vppinfra/vec_bootstrap.h b/src/vppinfra/vec_bootstrap.h index 006d16723e3..5c827d4aa5a 100644 --- a/src/vppinfra/vec_bootstrap.h +++ b/src/vppinfra/vec_bootstrap.h @@ -238,6 +238,10 @@ _vec_set_len (void *v, uword len, uword elt_sz) if (v) \ for ((var) = vec_len ((v)) - 1; (var) >= 0; (var)--) +#define vec_foreach_pointer(e, v) \ + for (typeof (**v) **__ep = (v), *(e) = *__ep; __ep - (v) < vec_len (v); \ + __ep++, (e) = *__ep) + #endif /* included_clib_vec_bootstrap_h */ /* |