MCPcopy Index your code
hub / github.com/antirez/botlib / cJSON_CreateString

Function cJSON_CreateString

cJSON.c:2446–2461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2444}
2445
2446CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2447{
2448 cJSON *item = cJSON_New_Item(&global_hooks);
2449 if(item)
2450 {
2451 item->type = cJSON_String;
2452 item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
2453 if(!item->valuestring)
2454 {
2455 cJSON_Delete(item);
2456 return NULL;
2457 }
2458 }
2459
2460 return item;
2461}
2462
2463CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
2464{

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