From 1fdcdb2dca97cdf4b8f4790aa66587ff3e89e526 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 14 Jul 2010 12:14:26 -0700 Subject: exec_list: Add a new replace_with method. --- src/glsl/list.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/glsl/list.h') diff --git a/src/glsl/list.h b/src/glsl/list.h index 48502fb4c8..29997c78ee 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -165,6 +165,17 @@ struct exec_node { this->prev->next = before; this->prev = before; } + /** + * Replace the current node with the given node. + */ + void replace_with(exec_node *replacement) + { + replacement->prev = this->prev; + replacement->next = this->next; + + this->prev->next = replacement; + this->next->prev = replacement; + } /** * Is this the sentinal at the tail of the list? -- cgit v1.2.3