mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-09-24 06:57:22 +00:00
Add cJSON_CreateStringReference
This commit is contained in:
@@ -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