MCPcopy Create free account
hub / github.com/armink/struct2json / cJSON_CreateString

Function cJSON_CreateString

struct2json/src/cJSON.c:709–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707cJSON *cJSON_CreateBool(int b) {cJSON *item=cJSON_New_Item();if(item)item->type=b?cJSON_True:cJSON_False;return item;}
708cJSON *cJSON_CreateNumber(double num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;item->valueint=(int)num;}return item;}
709cJSON *cJSON_CreateString(const char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJSON_strdup(string);}return item;}
710cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;return item;}
711cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;}
712

Callers 1

cJSON_CreateStringArrayFunction · 0.85

Calls 2

cJSON_New_ItemFunction · 0.85
cJSON_strdupFunction · 0.85

Tested by

no test coverage detected