summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-07-07 12:12:48 -0700
committerIan Romanick <[email protected]>2010-07-07 12:41:26 -0700
commitc44556317abf77ca6e344c79d119c91bebe25c8c (patch)
tree7c59e79a4cac6d35297b9e83f5199ef37627c552 /src
parent2e85f993d8a014b53ad2f6d295cf66d3fb38b091 (diff)
exec_list: Add method to append one complete list to another
Diffstat (limited to 'src')
-rw-r--r--src/glsl/list.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/glsl/list.h b/src/glsl/list.h
index d449bdd8b12..b5a413dc511 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -385,6 +385,30 @@ struct exec_list {
}
}
+ /**
+ * Append all nodes from the source list to the target list
+ */
+ void
+ append_list(exec_list *source)
+ {
+ if (source->is_empty())
+ return;
+
+ /* Link the first node of the source with the last node of the target list.
+ */
+ this->tail_pred->next = source->head;
+ source->head->prev = this->tail_pred;
+
+ /* Make the tail of the source list be the tail of the target list.
+ */
+ this->tail_pred = source->tail_pred;
+ this->tail_pred->next = (exec_node *) &this->tail;
+
+ /* Make the source list empty for good measure.
+ */
+ source->make_empty();
+ }
+
exec_list_iterator iterator()
{
return exec_list_iterator(head);