Function cJSON_CreateObjectReference

Synopsis

#include <cJSON.h>

cJSON * cJSON_CreateObjectReference(const cJSON *child)

Description

Create an object/array that only references it's elements so they will not be freed by cJSON_Delete

Mentioned in

Source

Lines 2475-2484 in cJSON.c. Line 211 in cJSON.h.

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;
}





Add Discussion as Guest

Log in