Re: [PATCH v3 2/3] config: add hashtable for config parsing & retrieval
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jun 26, 2014, 16:27 UTC
- Message-ID
- <vpqy4wjmyap.fsf@anie.imag.fr>
- In-Reply-To
- <53A96D2D.1020102@gmail.com>
Tanay Abhra <tanayabh@gmail.com> writes:
Show 10 quoted lines
> For the config_cache_free(), would this change be enough?
>
> +static void config_cache_free(void)
> +{
> + struct hashmap *config_cache;
> + struct config_cache_entry *entry;
> + struct hashmap_iter iter;
> + if (!hashmap_initialized)
> + return;
> + config_cache = get_config_cache();That sounds better to me. And it justifies the different scopes: one can ask whether the map is initialized from anywhere in the file, but can only get the map after initialization, so it prevents mis-use of an uninitialized pointer.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/