1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2001, 2003, 2005 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
14 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
15 |
||
16 |
||
243.1.17
by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.) |
17 |
#include <drizzled/server_includes.h> |
1
by brian
clean slate |
18 |
|
19 |
list_node end_of_list; |
|
20 |
||
21 |
void free_list(I_List <i_string_pair> *list) |
|
22 |
{
|
|
23 |
i_string_pair *tmp; |
|
24 |
while ((tmp= list->get())) |
|
25 |
delete tmp; |
|
26 |
}
|
|
27 |
||
28 |
||
29 |
void free_list(I_List <i_string> *list) |
|
30 |
{
|
|
31 |
i_string *tmp; |
|
32 |
while ((tmp= list->get())) |
|
33 |
delete tmp; |
|
34 |
}
|
|
35 |
||
36 |
||
37 |
base_list::base_list(const base_list &rhs, MEM_ROOT *mem_root) |
|
38 |
{
|
|
39 |
if (rhs.elements) |
|
40 |
{
|
|
41 |
/*
|
|
42 |
It's okay to allocate an array of nodes at once: we never
|
|
43 |
call a destructor for list_node objects anyway.
|
|
44 |
*/
|
|
45 |
first= (list_node*) alloc_root(mem_root, |
|
46 |
sizeof(list_node) * rhs.elements); |
|
47 |
if (first) |
|
48 |
{
|
|
49 |
elements= rhs.elements; |
|
50 |
list_node *dst= first; |
|
51 |
list_node *src= rhs.first; |
|
52 |
for (; dst < first + elements - 1; dst++, src= src->next) |
|
53 |
{
|
|
54 |
dst->info= src->info; |
|
55 |
dst->next= dst + 1; |
|
56 |
}
|
|
57 |
/* Copy the last node */
|
|
58 |
dst->info= src->info; |
|
59 |
dst->next= &end_of_list; |
|
60 |
/* Setup 'last' member */
|
|
61 |
last= &dst->next; |
|
62 |
return; |
|
63 |
}
|
|
64 |
}
|
|
65 |
elements= 0; |
|
66 |
first= &end_of_list; |
|
67 |
last= &first; |
|
68 |
}
|