From: Ian Romanick Date: Fri, 27 Aug 2010 20:53:56 +0000 (-0700) Subject: exec_node: Add insert_before that inserts an entire list X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79082b8aca130ecdcaa1167a9961c16fc620f423;p=mesa.git exec_node: Add insert_before that inserts an entire list --- diff --git a/src/glsl/list.h b/src/glsl/list.h index 76477743106..69cf9935f86 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. */