From cb5a0e59cf49421571563cd3afc0bfe0d4ee2aa8 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 9 Jun 2014 22:37:44 -0700 Subject: [PATCH] glsl: Move definition of exec_node member functions out of the struct. Reviewed-by: Ian Romanick --- src/glsl/list.h | 145 +++++++++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 62 deletions(-) diff --git a/src/glsl/list.h b/src/glsl/list.h index 694b686b08c..6216855a1d3 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -83,67 +83,29 @@ struct exec_node { /* empty */ } - const exec_node *get_next() const - { - return next; - } - - exec_node *get_next() - { - return next; - } - - const exec_node *get_prev() const - { - return prev; - } + const exec_node *get_next() const; + exec_node *get_next(); - exec_node *get_prev() - { - return prev; - } + const exec_node *get_prev() const; + exec_node *get_prev(); - void remove() - { - next->prev = prev; - prev->next = next; - next = NULL; - prev = NULL; - } + void remove(); /** * Link a node with itself * * This creates a sort of degenerate list that is occasionally useful. */ - void self_link() - { - next = this; - prev = this; - } + void self_link(); /** * Insert a node in the list after the current node */ - void insert_after(exec_node *after) - { - after->next = this->next; - after->prev = this; - - this->next->prev = after; - this->next = after; - } + void insert_after(exec_node *after); /** * Insert a node in the list before the current node */ - void insert_before(exec_node *before) - { - before->next = this; - before->prev = this->prev; - - this->prev->next = before; - this->prev = before; - } + void insert_before(exec_node *before); /** * Insert another list in the list before the current node @@ -153,33 +115,92 @@ struct exec_node { /** * 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; - } + void replace_with(exec_node *replacement); /** * Is this the sentinel at the tail of the list? */ - bool is_tail_sentinel() const - { - return this->next == NULL; - } + bool is_tail_sentinel() const; /** * Is this the sentinel at the head of the list? */ - bool is_head_sentinel() const - { - return this->prev == NULL; - } + bool is_head_sentinel() const; #endif }; +#ifdef __cplusplus +inline const exec_node *exec_node::get_next() const +{ + return next; +} + +inline exec_node *exec_node::get_next() +{ + return next; +} + +inline const exec_node *exec_node::get_prev() const +{ + return prev; +} + +inline exec_node *exec_node::get_prev() +{ + return prev; +} + +inline void exec_node::remove() +{ + next->prev = prev; + prev->next = next; + next = NULL; + prev = NULL; +} + +inline void exec_node::self_link() +{ + next = this; + prev = this; +} + +inline void exec_node::insert_after(exec_node *after) +{ + after->next = this->next; + after->prev = this; + + this->next->prev = after; + this->next = after; +} + +inline void exec_node::insert_before(exec_node *before) +{ + before->next = this; + before->prev = this->prev; + + this->prev->next = before; + this->prev = before; +} + +inline void exec_node::replace_with(exec_node *replacement) +{ + replacement->prev = this->prev; + replacement->next = this->next; + + this->prev->next = replacement; + this->next->prev = replacement; +} + +inline bool exec_node::is_tail_sentinel() const +{ + return this->next == NULL; +} + +inline bool exec_node::is_head_sentinel() const +{ + return this->prev == NULL; +} +#endif #ifdef __cplusplus /* This macro will not work correctly if `t' uses virtual inheritance. If you -- 2.30.2