Extract the given object from the chain, following nobj chain. */
| 2593 | |
| 2594 | /* Extract the given object from the chain, following nobj chain. */ |
| 2595 | void |
| 2596 | extract_nobj(struct obj *obj, struct obj **head_ptr) |
| 2597 | { |
| 2598 | struct obj *curr, *prev; |
| 2599 | |
| 2600 | curr = *head_ptr; |
| 2601 | for (prev = (struct obj *) 0; curr; prev = curr, curr = curr->nobj) { |
| 2602 | if (curr == obj) { |
| 2603 | if (prev) |
| 2604 | prev->nobj = curr->nobj; |
| 2605 | else |
| 2606 | *head_ptr = curr->nobj; |
| 2607 | break; |
| 2608 | } |
| 2609 | } |
| 2610 | if (!curr) |
| 2611 | panic("extract_nobj: object lost"); |
| 2612 | obj->where = OBJ_FREE; |
| 2613 | obj->nobj = (struct obj *) 0; |
| 2614 | } |
| 2615 | |
| 2616 | /* |
| 2617 | * Extract the given object from the chain, following nexthere chain. |
no test coverage detected