| 63 | } |
| 64 | |
| 65 | void list_move(struct list_node *dst_head, struct list_node *src_head) |
| 66 | { |
| 67 | assert(list_is_empty(dst_head)); |
| 68 | |
| 69 | if (list_is_empty(src_head)) |
| 70 | return; |
| 71 | |
| 72 | NEXT(dst_head) = NEXT(src_head); |
| 73 | PREV(dst_head) = PREV(src_head); |
| 74 | |
| 75 | /* The elements formerly in src_head's list must now point back to dst_head. */ |
| 76 | NEXT(PREV(dst_head)) = dst_head; |
| 77 | PREV(NEXT(dst_head)) = dst_head; |
| 78 | |
| 79 | /* Clear src_head to be empty. */ |
| 80 | list_clear(src_head); |
| 81 | } |
| 82 | |
| 83 | #undef NEXT |
| 84 | #undef PREV |