diff options
author | Tom Gundersen <teg@jklm.no> | 2015-07-16 14:06:11 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-07-16 14:11:12 +0200 |
commit | cb57dd41595adddb08095298bb1ed258c8ea4877 (patch) | |
tree | 6478f1aa84a405218ab50bc3508b1c39d0de20e2 /src/test | |
parent | 443a55981388f519fb6528a8ee042f9e69079b68 (diff) |
bitmap: use external iterator
Reuse the Iterator object from hashmap.h and expose a similar API.
This allows us to do
{
Iterator i;
unsigned n;
BITMAP_FOREACH(n, b, i) {
Iterator j;
unsigned m;
BITMAP_FOREACH(m, b, j) {
...
}
}
}
without getting confused. Requested by David.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-bitmap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/test-bitmap.c b/src/test/test-bitmap.c index 304888beb9..77db784a94 100644 --- a/src/test/test-bitmap.c +++ b/src/test/test-bitmap.c @@ -21,6 +21,7 @@ int main(int argc, const char *argv[]) { _cleanup_bitmap_free_ Bitmap *b = NULL; + Iterator it; unsigned n = (unsigned) -1, i = 0; b = bitmap_new(); @@ -61,7 +62,7 @@ int main(int argc, const char *argv[]) { assert_se(bitmap_set(b, 1) == 0); assert_se(bitmap_set(b, 256) == 0); - BITMAP_FOREACH(n, b) { + BITMAP_FOREACH(n, b, it) { assert_se(n == i); if (i == 0) i = 1; @@ -75,7 +76,7 @@ int main(int argc, const char *argv[]) { i = 0; - BITMAP_FOREACH(n, b) { + BITMAP_FOREACH(n, b, it) { assert_se(n == i); if (i == 0) i = 1; |