exec_list: Add a new replace_with method.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 14 Jul 2010 19:14:26 +0000 (12:14 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 14 Jul 2010 23:49:24 +0000 (16:49 -0700)
src/glsl/list.h

index 48502fb4c8cb9099dcb706e661be1e6eac4605f6..29997c78ee8e9f77130f67a57d61bd1319bdcff4 100644 (file)
@@ -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?