Replace array/object items with new ones. */
| 940 | |
| 941 | /* Replace array/object items with new ones. */ |
| 942 | void 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 | } |
| 960 | void cJSON_ReplaceItemInObject(cJSON *object, const char *string, |
| 961 | cJSON *newitem) |
| 962 | { |
no test coverage detected