summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorVijayabhaskar Katamreddy <vkatamre@cisco.com>2022-05-19 17:07:22 +0000
committerOle Tr�an <otroan@employees.org>2022-05-23 09:40:18 +0000
commitbeafecfc2e183d8b4036894e345847ad1ab351a9 (patch)
tree41425baf8388379a00e0a567fa882fb37e26805c /src/vppinfra
parentbc8c210f1de89d2b29c36c421cb98e8f16138f1c (diff)
ip: reassembly - fixing stepping index in a better way
Type: fix pool_is_free_index() check is performed only for the first element Signed-off-by: Vijayabhaskar Katamreddy <vkatamre@cisco.com> Change-Id: Icadc715a9b54761ec69805a134a69a262137536d
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/pool.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h
index dd581efeeab..ef816096ff0 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -561,16 +561,11 @@ do { \
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); \
- }
+#define pool_foreach_stepping_index(i, s, e, v) \
+ for ((i) = \
+ (pool_is_free_index ((v), (s)) ? pool_get_next_index ((v), (s)) : \
+ (s)); \
+ (i) < (e); (i) = pool_get_next_index ((v), (i)))
/**
* @brief Remove all elements from a pool in a safe way