MCPcopy Create free account
hub / github.com/OpenIPC/firmware / cJSON_CreateString

Function cJSON_CreateString

general/package/xmdp/src/cjson/cJSON.c:2453–2468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2451}
2452
2453CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2454{
2455 cJSON *item = cJSON_New_Item(&global_hooks);
2456 if(item)
2457 {
2458 item->type = cJSON_String;
2459 item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
2460 if(!item->valuestring)
2461 {
2462 cJSON_Delete(item);
2463 return NULL;
2464 }
2465 }
2466
2467 return item;
2468}
2469
2470CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
2471{

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