summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/bitmap.h8
-rw-r--r--src/vppinfra/elf.c4
-rw-r--r--src/vppinfra/timing_wheel.c12
3 files changed, 15 insertions, 9 deletions
diff --git a/src/vppinfra/bitmap.h b/src/vppinfra/bitmap.h
index 44411163975..5c56068da77 100644
--- a/src/vppinfra/bitmap.h
+++ b/src/vppinfra/bitmap.h
@@ -358,7 +358,13 @@ clib_bitmap_set_region (uword * bitmap, uword i, uword value, uword n_bits)
@param ai - the bitmap
@param body - the expression to evaluate for each set bit
*/
-#define clib_bitmap_foreach(i,ai,body) \
+#define clib_bitmap_foreach(i,ai) \
+ if (ai) \
+ for (i = clib_bitmap_first_set (ai); \
+ i != ~0; \
+ i = clib_bitmap_next_set (ai, i + 1))
+
+#define clib_bitmap_foreach_old(i,ai,body) \
do { \
uword __bitmap_i, __bitmap_ai, __bitmap_len, __bitmap_first_set; \
__bitmap_len = vec_len ((ai)); \
diff --git a/src/vppinfra/elf.c b/src/vppinfra/elf.c
index e32d989a602..c492b3b0795 100644
--- a/src/vppinfra/elf.c
+++ b/src/vppinfra/elf.c
@@ -1705,7 +1705,7 @@ layout_sections (elf_main_t * em)
s_lo = s_hi = 0;
/* *INDENT-OFF* */
- clib_bitmap_foreach (si, g->section_index_bitmap, ({
+ clib_bitmap_foreach (si, g->section_index_bitmap) {
u64 lo, hi;
s = vec_elt_at_index (em->sections, si);
@@ -1728,7 +1728,7 @@ layout_sections (elf_main_t * em)
if (hi > s_hi)
s_hi = hi;
}
- }));
+ }
/* *INDENT-ON* */
if (n_sections == 0)
diff --git a/src/vppinfra/timing_wheel.c b/src/vppinfra/timing_wheel.c
index a6c476b2cfa..2c46d72a2fe 100644
--- a/src/vppinfra/timing_wheel.c
+++ b/src/vppinfra/timing_wheel.c
@@ -303,11 +303,11 @@ timing_wheel_insert (timing_wheel_t * w, u64 insert_cpu_time, u32 user_data)
vec_foreach (l, w->levels)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (wi, l->occupancy_bitmap, ({
+ clib_bitmap_foreach (wi, l->occupancy_bitmap) {
l->elts[wi] = delete_user_data (l->elts[wi], user_data);
if (vec_len (l->elts[wi]) == 0)
l->occupancy_bitmap = clib_bitmap_andnoti (l->occupancy_bitmap, wi);
- }));
+ }
/* *INDENT-ON* */
}
@@ -486,7 +486,7 @@ advance_cpu_time_base (timing_wheel_t * w, u32 * expired_user_data)
{
uword wi;
/* *INDENT-OFF* */
- clib_bitmap_foreach (wi, l->occupancy_bitmap, ({
+ clib_bitmap_foreach (wi, l->occupancy_bitmap) {
vec_foreach (e, l->elts[wi])
{
/* This should always be true since otherwise we would have already expired
@@ -495,7 +495,7 @@ advance_cpu_time_base (timing_wheel_t * w, u32 * expired_user_data)
ASSERT (e->cpu_time_relative_to_base >= delta);
e->cpu_time_relative_to_base -= delta;
}
- }));
+ }
/* *INDENT-ON* */
}
@@ -648,10 +648,10 @@ timing_wheel_advance (timing_wheel_t * w, u64 advance_cpu_time,
level = vec_elt_at_index (w->levels, level_index);
/* *INDENT-OFF* */
- clib_bitmap_foreach (wi, level->occupancy_bitmap, ({
+ clib_bitmap_foreach (wi, level->occupancy_bitmap) {
expired_user_data = expire_bin (w, level_index, wi, advance_cpu_time,
expired_user_data);
- }));
+ }
/* *INDENT-ON* */
}