From: Ian Romanick Date: Tue, 17 Aug 2010 01:02:11 +0000 (-0700) Subject: exec_list: Add pop_head X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=29eebe9a9a0486f12e33e2818c192ef683fdfede;p=mesa.git exec_list: Add pop_head --- diff --git a/src/glsl/list.h b/src/glsl/list.h index a70b79d571f..76477743106 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -377,6 +377,23 @@ struct exec_list { head = n; } + /** + * Remove the first node from a list and return it + * + * \return + * The first node in the list or \c NULL if the list is empty. + * + * \sa exec_list::get_head + */ + exec_node *pop_head() + { + exec_node *const n = this->get_head(); + if (n != NULL) + n->remove(); + + return n; + } + /** * Move all of the nodes from this list to the target list */