Replace array/object items with new ones. */
| 934 | |
| 935 | /* Replace array/object items with new ones. */ |
| 936 | void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) |
| 937 | { |
| 938 | cJSON *c = array->child; |
| 939 | while (c && which > 0) |
| 940 | c = c->next, which--; |
| 941 | if (!c) |
| 942 | return; |
| 943 | newitem->next = c->next; |
| 944 | newitem->prev = c->prev; |
| 945 | if (newitem->next) |
| 946 | newitem->next->prev = newitem; |
| 947 | if (c == array->child) |
| 948 | array->child = newitem; |
| 949 | else |
| 950 | newitem->prev->next = newitem; |
| 951 | c->next = c->prev = 0; |
| 952 | cJSON_Delete(c); |
| 953 | } |
| 954 | void cJSON_ReplaceItemInObject(cJSON *object, const char *string, |
| 955 | cJSON *newitem) |
| 956 | { |
no test coverage detected