dllist_t *dllist_insert_before(dllist_t *l, void *d, void * pos) { dllist_t *newNode =NULL,*runNode = l; newNode = dllist_new(d); if(l == NULL) return newNode; runNode = dllist_find(l, pos); if(runNode == NULL) { _dllist_release(newNode); return l; } if(runNode->prev == NULL) { //insert head node runNode->prev = newNode; newNode->next = runNode; l = newNode; } else { newNode->next = runNode; newNode->prev = runNode->prev; runNode->prev = newNode; newNode->prev->next = newNode; } return l; }
void chunks_remove_data(chunks_t *c, struct chunk_ctx * ctx) { dllist_t *l = dllist_find(c->list, ctx); if (l) { c->total_bytes -= ctx->size; c->list = dllist_find_release(l, ctx); } }
/* Remove a pilot from the level */ void remove_pilot(struct Pilot *pilot) { struct dllist *lst = dllist_find(pilot_list,pilot); pilot_detach_rope(pilot); if(lst==pilot_list) pilot_list = dllist_remove(lst); else dllist_remove(lst); }