mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Add cJSON_CreateStringReference
This commit is contained in:
12
cJSON.c
12
cJSON.c
@@ -2198,6 +2198,18 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
|
||||
return item;
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
|
||||
{
|
||||
cJSON *item = cJSON_New_Item(&global_hooks);
|
||||
if (item != NULL)
|
||||
{
|
||||
item->type = cJSON_String | cJSON_IsReference;
|
||||
item->valuestring = cast_away_const_from_string(string);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw)
|
||||
{
|
||||
cJSON *item = cJSON_New_Item(&global_hooks);
|
||||
|
||||
Reference in New Issue
Block a user