diff options
author | Sachin <sachin.setiya@mariadb.com> | 2018-08-06 21:22:17 +0530 |
---|---|---|
committer | Sachin <sachin.setiya@mariadb.com> | 2018-08-07 15:41:13 +0530 |
commit | ad577091edf288e549c730933c514852b471991c (patch) | |
tree | 7cc51022e8de04014b146cc0e742c22473113b1b /sql/sql_list.h | |
parent | ebaacf0747bad9f41686a23f0b8ba4ff9f364f47 (diff) | |
download | mariadb-git-ad577091edf288e549c730933c514852b471991c.tar.gz |
MDEV-16904 inline void swap(base_list &rhs) should swap list only when list is...
not empty
We should swap the list only when list is not empty.
Diffstat (limited to 'sql/sql_list.h')
-rw-r--r-- | sql/sql_list.h | 5 |
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; } |