MCPcopy Index your code
hub / github.com/armink/struct2json / cJSON_AddItemToObject

Function cJSON_AddItemToObject

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

Source from the content-addressed store, hash-verified

682/* Add item to array/object. */
683void cJSON_AddItemToArray(cJSON *array, cJSON *item) {cJSON *c=array->child;if (!item) return; if (!c) {array->child=item;} else {while (c && c->next) c=c->next; suffix_object(c,item);}}
684void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item) {if (!item) return; if (item->string) cJSON_free(item->string);item->string=cJSON_strdup(string);cJSON_AddItemToArray(object,item);}
685void cJSON_AddItemToObjectCS(cJSON *object,const char *string,cJSON *item) {if (!item) return; if (!(item->type&cJSON_StringIsConst) && item->string) cJSON_free(item->string);item->string=(char*)string;item->type|=cJSON_StringIsConst;cJSON_AddItemToArray(object,item);}
686void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) {cJSON_AddItemToArray(array,create_reference(item));}
687void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item) {cJSON_AddItemToObject(object,string,create_reference(item));}

Callers 2

struct_to_jsonFunction · 0.85

Calls 2

cJSON_strdupFunction · 0.85
cJSON_AddItemToArrayFunction · 0.85

Tested by

no test coverage detected