Mesa (glsl2): exec_list: Add method to append one complete list to another

Ian Romanick idr at kemper.freedesktop.org
Wed Jul 7 12:45:33 PDT 2010


Module: Mesa
Branch: glsl2
Commit: c44556317abf77ca6e344c79d119c91bebe25c8c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c44556317abf77ca6e344c79d119c91bebe25c8c

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Jul  7 12:12:48 2010 -0700

exec_list: Add method to append one complete list to another

---

 src/glsl/list.h |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/glsl/list.h b/src/glsl/list.h
index d449bdd..b5a413d 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);



More information about the mesa-commit mailing list