diff options
author | Alexander Barkov <bar@mariadb.org> | 2018-02-12 10:03:28 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2018-02-12 10:03:28 +0400 |
commit | da99e086f90a4ec5a1188e51f4cc1dfc952ba771 (patch) | |
tree | 78fe85a44e55865d8cf7628764d5545f3f5e629b /sql/sql_list.cc | |
parent | 5559905d4186ce62c9df49d41d0f05c1189fd753 (diff) | |
parent | 7a106d19614cb052ecf245e3825b9510e8029ba0 (diff) | |
download | mariadb-git-da99e086f90a4ec5a1188e51f4cc1dfc952ba771.tar.gz |
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql/sql_list.cc')
-rw-r--r-- | sql/sql_list.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sql/sql_list.cc b/sql/sql_list.cc index 2c1b3c47d55..c63c83f0645 100644 --- a/sql/sql_list.cc +++ b/sql/sql_list.cc @@ -38,21 +38,21 @@ void free_list(I_List <i_string> *list) } -base_list::base_list(const base_list &rhs, MEM_ROOT *mem_root) +bool base_list::copy(const base_list *rhs, MEM_ROOT *mem_root) { - if (rhs.elements) + bool error= 0; + if (rhs->elements) { /* It's okay to allocate an array of nodes at once: we never call a destructor for list_node objects anyway. */ - first= (list_node*) alloc_root(mem_root, - sizeof(list_node) * rhs.elements); - if (first) + if ((first= (list_node*) alloc_root(mem_root, + sizeof(list_node) * rhs->elements))) { - elements= rhs.elements; + elements= rhs->elements; list_node *dst= first; - list_node *src= rhs.first; + list_node *src= rhs->first; for (; dst < first + elements - 1; dst++, src= src->next) { dst->info= src->info; @@ -63,10 +63,12 @@ base_list::base_list(const base_list &rhs, MEM_ROOT *mem_root) dst->next= &end_of_list; /* Setup 'last' member */ last= &dst->next; - return; + return 0; } + error= 1; } elements= 0; first= &end_of_list; last= &first; + return error; } |