summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-format1
-rw-r--r--src/vppinfra/vec_bootstrap.h4
2 files changed, 5 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
index 0680770a07f..050505b168b 100644
--- a/.clang-format
+++ b/.clang-format
@@ -18,6 +18,7 @@ ForEachMacros:
- 'vec_foreach_backwards'
- 'vec_foreach_index'
- 'vec_foreach_index_backwards'
+ - 'vec_foreach_pointer'
- 'vlib_foreach_rx_tx'
- 'foreach_vlib_main'
- 'foreach_set_bit_index'
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 */
/*