summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin <sachin.setiya@mariadb.com>2018-08-06 21:22:17 +0530
committerSachin <sachin.setiya@mariadb.com>2018-08-06 21:22:17 +0530
commit877a71f31912ad97bc8e29fb96c9b9e54913f8b4 (patch)
tree67cb803c8128bdb4958e81c8332963501ea12eed
parent68ebfb31f215247d2fa08c8ed97a320191afc179 (diff)
downloadmariadb-git-bb-5.5-16904.tar.gz
MDEV-16904 inline void swap(base_list &rhs) should swap list only when list is...bb-5.5-16904
not empty We should swap the list only when list is not empty.
-rw-r--r--sql/sql_list.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_list.h b/sql/sql_list.h
index 08667bed02a..8956a786715 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -306,10 +306,13 @@ public:
*/
inline void swap(base_list &rhs)
{
+ list_node **rhs_last=rhs.last;
swap_variables(list_node *, first, rhs.first);
- swap_variables(list_node **, last, rhs.last);
swap_variables(uint, elements, rhs.elements);
+ rhs.last= last == &first ? &rhs.first : last;
+ last = rhs_last == &rhs.first ? &first : rhs_last;
}
+
inline list_node* last_node() { return *last; }
inline list_node* first_node() { return first;}
inline void *head() { return first->info; }