MCPcopy Index your code
hub / github.com/binbyu/Reader / cJSON_CreateString

Function cJSON_CreateString

opensrc/cjson/cJSON.c:2318–2333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2316}
2317
2318CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2319{
2320 cJSON *item = cJSON_New_Item(&global_hooks);
2321 if(item)
2322 {
2323 item->type = cJSON_String;
2324 item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
2325 if(!item->valuestring)
2326 {
2327 cJSON_Delete(item);
2328 return NULL;
2329 }
2330 }
2331
2332 return item;
2333}
2334
2335CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
2336{

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