mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-10-16 10:39:53 +00:00
Add cJSON_Create{Array,Object}Reference
This commit is contained in:
1 parent
1f543f0e28
commit
11844dd5a6
3 files changed
+62
No files matched your search
@@ -2210,6 +2210,27 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
|
||||
return item;
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child)
|
||||
{
|
||||
cJSON *item = cJSON_New_Item(&global_hooks);
|
||||
if (item != NULL) {
|
||||
item->type = cJSON_Object | cJSON_IsReference;
|
||||
item->child = (cJSON*)cast_away_const(child);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) {
|
||||
cJSON *item = cJSON_New_Item(&global_hooks);
|
||||
if (item != NULL) {
|
||||
item->type = cJSON_Array | cJSON_IsReference;
|
||||
item->child = (cJSON*)cast_away_const(child);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw)
|
||||
{
|
||||
cJSON *item = cJSON_New_Item(&global_hooks);
|
||||
|
||||
Reference in new issue
Block a user