From a5d15fbccff504461b824b130f9cbc27905264a8 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Mon, 26 Apr 2021 16:05:17 -0700 Subject: fix(bio): buffer copying error --- include/libn/macro/map.h | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/libn/macro/map.h b/include/libn/macro/map.h index fae50ee..0743c1b 100644 --- a/include/libn/macro/map.h +++ b/include/libn/macro/map.h @@ -161,7 +161,6 @@ static const double __ac_HASH_UPPER = 0.77; return 0; #define MAP_PUT(map, key, val, hashfunc, equalfunc, resizefunc, err) \ - { \ int32 x = 0; \ if (map->n_occupied >= map->upper_bound) { \ if (map->n_buckets > (map->size << 1)) { \ @@ -214,16 +213,13 @@ static const double __ac_HASH_UPPER = 0.77; ++map->size; \ } else \ *err = 0; \ - return x; \ - } + return x; #define MAP_DEL(map, x) \ - { \ if (x != map->n_buckets && !__ac_iseither(map->flags, x)) { \ __ac_set_isdel_true(map->flags, x); \ --map->size; \ - } \ - } + } #define KEY_EXIST(m, x) (!__ac_iseither((m)->flags, (x))) @@ -232,7 +228,7 @@ static const double __ac_HASH_UPPER = 0.77; #define SET_STRUCT_BODY(key_t) \ int32 n_buckets, size, n_occupied, upper_bound; \ int32 *flags; \ - key_t *keys; \ + key_t *keys \ #define SET_MAKE(type, h, alloc) \ type *set; \ @@ -242,7 +238,7 @@ static const double __ac_HASH_UPPER = 0.77; #define SET_FREE(set, free, h) \ free(h, set->keys); \ free(h, set->flags); \ - free(h, set); + free(h, set) #define SET_RESET(set) \ if (set && set->flags) { \ @@ -343,7 +339,6 @@ static const double __ac_HASH_UPPER = 0.77; return 0; #define SET_PUT(set, key, hashfunc, equalfunc, resizefunc, err) \ - { \ int32 x = 0; \ if (set->n_occupied >= set->upper_bound) { \ if (set->n_buckets > (set->size << 1)) { \ @@ -396,13 +391,10 @@ static const double __ac_HASH_UPPER = 0.77; ++set->size; \ } else \ *err = 0; \ - return x; \ - } + return x #define SET_DEL(set, x) \ - { \ if (x != set->n_buckets && !__ac_iseither(set->flags, x)) { \ __ac_set_isdel_true(set->flags, x); \ --set->size; \ - } \ - } + } -- cgit v1.2.1