From: Eric Sunshine Date: Tue, 10 Jun 2014 11:45:45 GMT Subject: Re: [PATCH v1] config: Add hashtable for config parsing & retrival Message-ID: In-Reply-To: <1402318146-5062-2-git-send-email-tanayabh@gmail.com> One additional comment... On Mon, Jun 9, 2014 at 8:49 AM, Tanay Abhra wrote: > +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 > + 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; > +}