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

Function cJSON_ReplaceItemInObject

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

Source from the content-addressed store, hash-verified

699 newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem;
700 if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);}
701void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem){int i=0;cJSON *c=object->child;while(c && cJSON_strcasecmp(c->string,string))i++,c=c->next;if(c){newitem->string=cJSON_strdup(string);cJSON_ReplaceItemInArray(object,i,newitem);}}
702
703/* Create basic types: */
704cJSON *cJSON_CreateNull(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_NULL;return item;}

Callers

nothing calls this directly

Calls 3

cJSON_strcasecmpFunction · 0.85
cJSON_strdupFunction · 0.85
cJSON_ReplaceItemInArrayFunction · 0.85

Tested by

no test coverage detected