MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / cJSON_CreateString

Function cJSON_CreateString

libapp2sys/src/main/cpp/cjson/cJSON.c:2324–2339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2322}
2323
2324CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2325{
2326 cJSON *item = cJSON_New_Item(&global_hooks);
2327 if(item)
2328 {
2329 item->type = cJSON_String;
2330 item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
2331 if(!item->valuestring)
2332 {
2333 cJSON_Delete(item);
2334 return NULL;
2335 }
2336 }
2337
2338 return item;
2339}
2340
2341CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
2342{

Callers 4

cJSON_AddStringToObjectFunction · 0.85
cJSON_CreateStringArrayFunction · 0.85

Calls 3

cJSON_New_ItemFunction · 0.85
cJSON_strdupFunction · 0.85
cJSON_DeleteFunction · 0.85

Tested by

no test coverage detected