| 2069 | } |
| 2070 | |
| 2071 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) |
| 2072 | { |
| 2073 | if ((parent == NULL) || (item == NULL)) |
| 2074 | { |
| 2075 | return NULL; |
| 2076 | } |
| 2077 | |
| 2078 | if (item->prev != NULL) |
| 2079 | { |
| 2080 | /* not the first element */ |
| 2081 | item->prev->next = item->next; |
| 2082 | } |
| 2083 | if (item->next != NULL) |
| 2084 | { |
| 2085 | /* not the last element */ |
| 2086 | item->next->prev = item->prev; |
| 2087 | } |
| 2088 | |
| 2089 | if (item == parent->child) |
| 2090 | { |
| 2091 | /* first element */ |
| 2092 | parent->child = item->next; |
| 2093 | } |
| 2094 | /* make sure the detached item doesn't point anywhere anymore */ |
| 2095 | item->prev = NULL; |
| 2096 | item->next = NULL; |
| 2097 | |
| 2098 | return item; |
| 2099 | } |
| 2100 | |
| 2101 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) |
| 2102 | { |
no outgoing calls
no test coverage detected