MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / cJSON_ReplaceItemInArray

Function cJSON_ReplaceItemInArray

eval/LANE_evaluation/lane2d/src/cJSON.c:942–959  ·  view source on GitHub ↗

Replace array/object items with new ones. */

Source from the content-addressed store, hash-verified

940
941/* Replace array/object items with new ones. */
942void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem)
943{
944 cJSON *c = array->child;
945 while (c && which > 0)
946 c = c->next, which--;
947 if (!c)
948 return;
949 newitem->next = c->next;
950 newitem->prev = c->prev;
951 if (newitem->next)
952 newitem->next->prev = newitem;
953 if (c == array->child)
954 array->child = newitem;
955 else
956 newitem->prev->next = newitem;
957 c->next = c->prev = 0;
958 cJSON_Delete(c);
959}
960void cJSON_ReplaceItemInObject(cJSON *object, const char *string,
961 cJSON *newitem)
962{

Callers 4

ReplaceMethod · 0.85
ReplaceWithMoveMethod · 0.85
ReplaceWithNullMethod · 0.85

Calls 1

cJSON_DeleteFunction · 0.85

Tested by

no test coverage detected