summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/pool.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h
index 2a356291051..dd581efeeab 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -555,11 +555,22 @@ do { \
_pool_var(rv); \
})
-#define pool_foreach_index(i,v) \
- if (v) \
- for (i = pool_get_first_index (v); \
- i < vec_len (v); \
- i = pool_get_next_index (v, i)) \
+#define pool_foreach_index(i, v) \
+ if (v) \
+ for (i = pool_get_first_index (v); i < vec_len (v); \
+ i = pool_get_next_index (v, i))
+
+/* Iterate pool by index from s to e */
+#define pool_foreach_stepping_index(i, s, e, v, body) \
+ for ((i) = (s); (i) < (e); (i) = pool_get_next_index (v, i)) \
+ { \
+ if (!pool_is_free_index ((v), (i))) \
+ do \
+ { \
+ body; \
+ } \
+ while (0); \
+ }
/**
* @brief Remove all elements from a pool in a safe way