summaryrefslogtreecommitdiff
path: root/src/glsl/list.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-08-27 13:53:56 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-09-03 11:55:21 -0700
commit79082b8aca130ecdcaa1167a9961c16fc620f423 (patch)
tree058805718b03747248487b6f9c7c39fa4980ad08 /src/glsl/list.h
parent7850ce0a9990c7f752e43a1dd88c204a7cf090aa (diff)
exec_node: Add insert_before that inserts an entire list
Diffstat (limited to 'src/glsl/list.h')
-rw-r--r--src/glsl/list.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/glsl/list.h b/src/glsl/list.h
index 7647774310..69cf9935f8 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -165,6 +165,12 @@ struct exec_node {
this->prev->next = before;
this->prev = before;
}
+
+ /**
+ * Insert another list in the list before the current node
+ */
+ void insert_before(class exec_list *before);
+
/**
* Replace the current node with the given node.
*/
@@ -449,6 +455,23 @@ struct exec_list {
#endif
};
+
+#ifdef __cplusplus
+inline void exec_node::insert_before(exec_list *before)
+{
+ if (before->is_empty())
+ return;
+
+ before->tail_pred->next = this;
+ before->head->prev = this->prev;
+
+ this->prev->next = before->head;
+ this->prev = before->tail_pred;
+
+ before->make_empty();
+}
+#endif
+
/**
* This version is safe even if the current node is removed.
*/