From: Eric Haszlakiewicz Date: Tue, 29 Sep 2015 02:25:29 +0000 (-0400) Subject: Merge pull request #196 from rgerhards/improve-performance X-Git-Tag: json-c-0.13-20171207~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12916e229c769da4929f6df7f038ab51cf0cb067;p=thirdparty%2Fjson-c.git Merge pull request #196 from rgerhards/improve-performance Performance improvements --- 12916e229c769da4929f6df7f038ab51cf0cb067 diff --cc json_object.c index e6bd8701,8dd60827..6ec67a0f --- a/json_object.c +++ b/json_object.c @@@ -410,13 -438,14 +445,14 @@@ void json_object_object_add(struct json // and re-adding it, so the existing key remains valid. json_object *existing_value = NULL; struct lh_entry *existing_entry; - existing_entry = lh_table_lookup_entry(jso->o.c_object, (void*)key); + const unsigned long hash = lh_get_hash(jso->o.c_object, (void*)key); + existing_entry = lh_table_lookup_entry_w_hash(jso->o.c_object, (void*)key, hash); if (!existing_entry) { - lh_table_insert(jso->o.c_object, strdup(key), val); + lh_table_insert_w_hash(jso->o.c_object, strdup(key), val, hash, 0); return; } - existing_value = (void *)existing_entry->v; + existing_value = (json_object *)existing_entry->v; if (existing_value) json_object_put(existing_value); existing_entry->v = val;