MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / cJSON_DetachItemViaPointer

Function cJSON_DetachItemViaPointer

cJSON.c:2243–2277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2241}
2242
2243CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item)
2244{
2245 if ((parent == NULL) || (item == NULL) || (item != parent->child && item->prev == NULL))
2246 {
2247 return NULL;
2248 }
2249
2250 if (item != parent->child)
2251 {
2252 /* not the first element */
2253 item->prev->next = item->next;
2254 }
2255 if (item->next != NULL)
2256 {
2257 /* not the last element */
2258 item->next->prev = item->prev;
2259 }
2260
2261 if (item == parent->child)
2262 {
2263 /* first element */
2264 parent->child = item->next;
2265 }
2266 else if (item->next == NULL)
2267 {
2268 /* last element */
2269 parent->child->prev = item->prev;
2270 }
2271
2272 /* make sure the detached item doesn't point anywhere anymore */
2273 item->prev = NULL;
2274 item->next = NULL;
2275
2276 return item;
2277}
2278
2279CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which)
2280{

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…