libsepol: add ebitmap_for_each_set_bit macro
Most of the users of ebitmap_for_each_bit() macro only care for the set
bits, so introduce a new ebitmap_for_each_positive_bit() macro that
skips the unset bits. Replace uses of ebitmap_for_each_bit() with the
new macro where appropriate.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
diff --git a/libsepol/tests/test-linker-roles.c b/libsepol/tests/test-linker-roles.c
index c9e2f2b..6843252 100644
--- a/libsepol/tests/test-linker-roles.c
+++ b/libsepol/tests/test-linker-roles.c
@@ -58,11 +58,9 @@
unsigned int i;
int found = 0;
- ebitmap_for_each_bit(&role->dominates, tnode, i) {
- if (ebitmap_node_get_bit(tnode, i)) {
- found++;
- CU_ASSERT(i == role->s.value - 1);
- }
+ ebitmap_for_each_positive_bit(&role->dominates, tnode, i) {
+ found++;
+ CU_ASSERT(i == role->s.value - 1);
}
CU_ASSERT(found == 1);
}