summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--list.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/list.h b/list.h
index 33b038ce8d..054be7ed43 100644
--- a/list.h
+++ b/list.h
@@ -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()