~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_list.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
 
#include "config.h"
18
 
 
19
 
#include "drizzled/sql_list.h"
20
 
 
21
 
namespace drizzled
22
 
{
 
17
#include <drizzled/server_includes.h>
23
18
 
24
19
list_node end_of_list;
25
20
 
26
 
} /* namespace drizzled */
 
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
}