mirror of
https://github.com/json-c/json-c.git
synced 2026-03-29 01:49:06 +08:00
Really use prefix JSON_C_OBJECT_ADD_*
This change introduces JSON_C_OBJECT_ADD_CONSTANT_KEY as a replacement of JSON_C_OBJECT_KEY_IS_CONSTANT. The description of json_object_object_add_ex tells to look at the flags JSON_C_OBJECT_ADD_* but it is not for JSON_C_OBJECT_KEY_IS_CONSTANT. From the point of vue of a developper using json-c, the function json_object_object_add_ex is mainly used, not the hash facility, it seems more natural to provide a regular naming of prefix JSON_C_OBJECT_ADD_CONSTANT_KEY.
This commit is contained in:
@@ -546,7 +546,7 @@ int lh_table_resize(struct lh_table *t, int new_size)
|
||||
unsigned long h = lh_get_hash(new_t, ent->k);
|
||||
unsigned int opts = 0;
|
||||
if (ent->k_is_constant)
|
||||
opts = JSON_C_OBJECT_KEY_IS_CONSTANT;
|
||||
opts = JSON_C_OBJECT_ADD_CONSTANT_KEY;
|
||||
if (lh_table_insert_w_hash(new_t, ent->k, ent->v, h, opts) != 0)
|
||||
{
|
||||
lh_table_free(new_t);
|
||||
@@ -599,7 +599,7 @@ int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, con
|
||||
}
|
||||
|
||||
t->table[n].k = k;
|
||||
t->table[n].k_is_constant = (opts & JSON_C_OBJECT_KEY_IS_CONSTANT);
|
||||
t->table[n].k_is_constant = (opts & JSON_C_OBJECT_ADD_CONSTANT_KEY);
|
||||
t->table[n].v = v;
|
||||
t->count++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user