diff options
Diffstat (limited to 'zap/src/foreach.c')
-rw-r--r-- | zap/src/foreach.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/zap/src/foreach.c b/zap/src/foreach.c index 54911e9..5e281d4 100644 --- a/zap/src/foreach.c +++ b/zap/src/foreach.c @@ -6,11 +6,13 @@ #include <zap/priv.h> +#include <zap/mem.h> + #include <stddef.h> void zap_foreach(void * const _ptr,size_t const _sz,size_t const _num,void (* const _fn)(void *)) { - unsigned char * ptr = _ptr; - size_t const numbyte = _sz * _num; - void * const afterbuf = ptr + numbyte; - for (;ptr != afterbuf;ptr += _sz) {_fn(ptr);} + unsigned char * pos = _ptr; + size_t const numbyte = _sz * _num; + unsigned char * const afterbuf = pos + numbyte; + for (;pos != afterbuf;pos += _sz) {_fn(pos);} } |