summaryrefslogtreecommitdiff
path: root/src/libdatastruct/gensetdyn_iter.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-06-13 22:19:05 +0000
committerLaurent Bercot <ska@appnovation.com>2023-06-13 22:19:05 +0000
commit193a7be520502f24e995b71768dd89c37b3776eb (patch)
tree29a1d10e1e74220c9d0d463bbcb03aa7c1954583 /src/libdatastruct/gensetdyn_iter.c
parent8fac1ec21fc54a050822258d8873b9a87a2bd2fe (diff)
downloadskalibs-193a7be520502f24e995b71768dd89c37b3776eb.tar.xz
Fix iter_func type; add tain_earliest
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libdatastruct/gensetdyn_iter.c')
-rw-r--r--src/libdatastruct/gensetdyn_iter.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/libdatastruct/gensetdyn_iter.c b/src/libdatastruct/gensetdyn_iter.c
deleted file mode 100644
index 8470adf..0000000
--- a/src/libdatastruct/gensetdyn_iter.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ISC license. */
-
-#include <sys/types.h>
-#include <skalibs/bitarray.h>
-#include <skalibs/gensetdyn.h>
-
-uint32_t gensetdyn_iter_nocancel (gensetdyn *g, uint32_t n, iter_func_ref f, void *stuff)
-{
- /*
- XXX: we may be called by a freeing function, so we cannot alloc -
- XXX: so pray that the bitarray fits in the stack.
- */
- unsigned char bits[bitarray_div8(g->storage.len) ? bitarray_div8(g->storage.len) : 1] ;
- size_t i = 0 ;
- uint32_t j = 0 ;
- uint32_t *fl = genalloc_s(uint32_t, &g->freelist) ;
- size_t sp = genalloc_len(uint32_t, &g->freelist) ;
- bitarray_setn(bits, 0, g->storage.len) ;
-
- for (; i < sp ; i++) if (fl[i] < g->storage.len) bitarray_clear(bits, fl[i]) ;
- for (i = 0 ; (i < g->storage.len) && (j < n) ; i++) if (bitarray_peek(bits, i))
- {
- j++ ;
- if (!(*f)(gensetdyn_p(g, i), stuff)) break ;
- }
- return j ;
-}