summaryrefslogtreecommitdiff
path: root/src/libdatastruct/gensetdyn_iter.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-02-22 10:03:15 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-02-22 10:03:15 +0000
commita5079576ae9007fb1ca7ebcc911b5fb035cd2d06 (patch)
tree70f4014dd37d780dfb45182d26092cb1998d4eec /src/libdatastruct/gensetdyn_iter.c
parent49d8fa1058aaf23c29e074b2314492ae40d2f557 (diff)
downloadskalibs-a5079576ae9007fb1ca7ebcc911b5fb035cd2d06.tar.xz
Types change: switch libdatastruct to uint32_t
Still needs to be reviewed.
Diffstat (limited to 'src/libdatastruct/gensetdyn_iter.c')
-rw-r--r--src/libdatastruct/gensetdyn_iter.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libdatastruct/gensetdyn_iter.c b/src/libdatastruct/gensetdyn_iter.c
index b4e1638..c5bbcef 100644
--- a/src/libdatastruct/gensetdyn_iter.c
+++ b/src/libdatastruct/gensetdyn_iter.c
@@ -1,19 +1,22 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/bitarray.h>
#include <skalibs/functypes.h>
#include <skalibs/gensetdyn.h>
-unsigned int gensetdyn_iter_nocancel (gensetdyn *g, unsigned int n, iterfunc_t_ref f, void *stuff)
+uint32_t gensetdyn_iter_nocancel (gensetdyn *g, uint32_t n, iterfunc_t_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)] ;
- unsigned int i = 0, j = 0 ;
- register unsigned int *fl = genalloc_s(unsigned int, &g->freelist) ;
- register unsigned int sp = genalloc_len(unsigned int, &g->freelist) ;
+ 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]) ;