From a5079576ae9007fb1ca7ebcc911b5fb035cd2d06 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 22 Feb 2017 10:03:15 +0000 Subject: Types change: switch libdatastruct to uint32_t Still needs to be reviewed. --- src/libdatastruct/gensetdyn_iter.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/libdatastruct/gensetdyn_iter.c') 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 +#include #include #include #include -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]) ; -- cgit v1.2.3