diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-31 18:15:50 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-31 18:15:50 -0700 |
commit | acce380a3f6df56d44460c0b066b4791cc0f9732 (patch) | |
tree | 695ea957884d52f3b9d54f732a8dec6ebbe95206 /list.h | |
parent | e29a5859891eb9e1587396dea0e8010f7d88f68c (diff) |
Fix exec_list::move_nodes_to when the source list is empty
Diffstat (limited to 'list.h')
-rw-r--r-- | list.h | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -273,14 +273,18 @@ struct exec_list { */ void move_nodes_to(exec_list *target) { - target->head = head; - target->tail = NULL; - target->tail_pred = tail_pred; - - target->head->prev = (exec_node *) &target->head; - target->tail_pred->next = (exec_node *) &target->tail; - - make_empty(); + if (is_empty()) { + target->make_empty(); + } else { + target->head = head; + target->tail = NULL; + target->tail_pred = tail_pred; + + target->head->prev = (exec_node *) &target->head; + target->tail_pred->next = (exec_node *) &target->tail; + + make_empty(); + } } exec_list_iterator iterator() |