MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / cJSON_CreateString

Function cJSON_CreateString

TheForceEngine/TFE_System/cJSON.c:2465–2480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2463}
2464
2465CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2466{
2467 cJSON *item = cJSON_New_Item(&global_hooks);
2468 if(item)
2469 {
2470 item->type = cJSON_String;
2471 item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
2472 if(!item->valuestring)
2473 {
2474 cJSON_Delete(item);
2475 return NULL;
2476 }
2477 }
2478
2479 return item;
2480}
2481
2482CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
2483{

Callers 2

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