Re: [PATCH v1] config: Add hashtable for config parsing & retrival
On 06/10/2014 04:45 AM, Eric Sunshine wrote:
Show 18 quoted lines
> One additional comment...
>
> On Mon, Jun 9, 2014 at 8:49 AM, Tanay Abhra <tanayabh@gmail.com> 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].
> Noted. Thanks for pointing it out.
Show 10 quoted lines
> [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;
>> +}