mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Add cJSON_AddItemReferenceToObjectCS constant-string variant
This can not be implemented externally, since create_reference() is not exposed.
This commit is contained in:
10
cJSON.c
10
cJSON.c
@@ -2132,6 +2132,16 @@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const cha
|
||||
return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false);
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObjectCS(cJSON *object, const char *string, cJSON *item)
|
||||
{
|
||||
if ((object == NULL) || (string == NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, true);
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name)
|
||||
{
|
||||
cJSON *null = cJSON_CreateNull();
|
||||
|
||||
Reference in New Issue
Block a user