Re: [PATCH v1] config: Add hashtable for config parsing & retrival
One additional comment...
On Mon, Jun 9, 2014 at 8:49 AM, Tanay Abhra <tanayabh@gmail.com> wrote:
Show 12 quoted lines
> +static int config_cache_set_value(const char *key, const char *value)
> +{
> + struct hashmap *config_cache;
> + struct config_cache_entry *e;
> +
> + config_cache = get_config_cache();
> + e = config_cache_find_entry(key);
> + if (!e) {
> + e = xmalloc(sizeof(*e));
> + hashmap_entry_init(e, strhash(key));
> + e->key = xstrdup(key);
> + e->value_list = xcalloc(sizeof(struct string_list), 1);Order of xcalloc() arguments is incorrect [1].
[1]: http://git.661346.n2.nabble.com/PATCH-00-15-Rearrange-xcalloc-arguments-td7611675.html
Show 8 quoted lines
> + e->value_list->strdup_strings = 1;
> + string_list_append(e->value_list, value);
> + hashmap_add(config_cache, e);
> + } else {
> + string_list_append(e->value_list, value);
> + }
> + return 0;
> +}