diff options
author | igor@rurik.mysql.com <> | 2004-10-09 10:34:13 -0700 |
---|---|---|
committer | igor@rurik.mysql.com <> | 2004-10-09 10:34:13 -0700 |
commit | 71f6ab7a09fa8cb225315f74caae6b507af9a029 (patch) | |
tree | 84324c7af32f54d423310e3a2ee3255f7f43749b /sql/sql_list.h | |
parent | 80d2d8d662d9e3db96295d831358a5d633a3c2eb (diff) | |
parent | 0dcc255b9b64df1767091c438678049cc1acdd7e (diff) | |
download | mariadb-git-71f6ab7a09fa8cb225315f74caae6b507af9a029.tar.gz |
Merge for Item_equal.
Diffstat (limited to 'sql/sql_list.h')
-rw-r--r-- | sql/sql_list.h | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/sql/sql_list.h b/sql/sql_list.h index a4379b74c17..40530314893 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -127,10 +127,12 @@ public: void remove(list_node **prev) { list_node *node=(*prev)->next; - delete *prev; - *prev=node; if (!--elements) last= &first; + else if (last == &(*prev)->next) + last= prev; + delete *prev; + *prev=node; } inline void *pop(void) { @@ -143,9 +145,36 @@ public: } inline void concat(base_list *list) { - *last= list->first; - last= list->last; - elements+= list->elements; + if (!list->is_empty()) + { + *last= list->first; + last= list->last; + elements+= list->elements; + } + } + inline void disjoin(base_list *list) + { + list_node **prev= &first; + list_node *node= first; + list_node *list_first= list->first; + elements=0; + while (node && node != list_first) + { + prev= &node->next; + node= node->next; + elements++; + } + *prev= *last; + last= prev; + } + inline void prepand(base_list *list) + { + if (!list->is_empty()) + { + *list->last= first; + first= list->first; + elements+= list->elements; + } } inline list_node* last_node() { return *last; } inline list_node* first_node() { return first;} @@ -257,6 +286,9 @@ public: inline T* head() {return (T*) base_list::head(); } inline T** head_ref() {return (T**) base_list::head_ref(); } inline T* pop() {return (T*) base_list::pop(); } + inline void concat(List<T> *list) { base_list::concat(list); } + inline void disjoin(List<T> *list) { base_list::disjoin(list); } + inline void prepand(List<T> *list) { base_list::prepand(list); } void delete_elements(void) { list_node *element,*next; @@ -267,7 +299,6 @@ public: } empty(); } - inline void concat(List<T> *list) { base_list::concat(list); } }; @@ -278,6 +309,8 @@ public: inline T* operator++(int) { return (T*) base_list_iterator::next(); } inline T *replace(T *a) { return (T*) base_list_iterator::replace(a); } inline T *replace(List<T> &a) { return (T*) base_list_iterator::replace(a); } + inline void rewind(void) { base_list_iterator::rewind(); } + inline void remove() { base_list_iterator::remove(); } inline void after(T *a) { base_list_iterator::after(a); } inline T** ref(void) { return (T**) base_list_iterator::ref(); } }; |