From: Simon Ruderich Date: Sat, 02 Sep 2017 08:39:20 GMT Subject: Re: [PATCH] hashmap: add API to disable item counting when threaded Message-ID: <20170902083920.simgdrdteorxt6yo@ruderich.org> In-Reply-To: <20170830185922.10107-2-git@jeffhostetler.com> On Wed, Aug 30, 2017 at 06:59:22PM +0000, Jeff Hostetler wrote: > [snip] > +/* > + * Re-enable item couting when adding/removing items. > + * If counting is currently disabled, it will force count them. The code always recounts them. Either the comment or the code should be adjusted. > + * This might be used after leaving a threaded section. > + */ > +static inline void hashmap_enable_item_counting(struct hashmap *map) > +{ > + void *item; > + unsigned int n = 0; > + struct hashmap_iter iter; > + > + hashmap_iter_init(map, &iter); > + while ((item = hashmap_iter_next(&iter))) > + n++; > + > + map->do_count_items = 1; > + map->private_size = n; > +} Regards Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9