~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_list.h

Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    last= elements ? tmp.last : &first;
133
133
  }
134
134
  base_list(bool) { }
135
 
  bool push_back(void *info)
136
 
  {
137
 
    if (((*last)=new list_node(info, &end_of_list)))
138
 
    {
139
 
      last= &(*last)->next;
140
 
      elements++;
141
 
      return 0;
142
 
    }
143
 
    return 1;
144
 
  }
145
 
  bool push_back(void *info, memory::Root *mem_root)
146
 
  {
147
 
    if (((*last)=new (mem_root) list_node(info, &end_of_list)))
148
 
    {
149
 
      last= &(*last)->next;
150
 
      elements++;
151
 
      return 0;
152
 
    }
153
 
    return 1;
154
 
  }
155
 
  bool push_front(void *info)
 
135
  void push_back(void *info)
 
136
  {
 
137
    *last = new list_node(info, &end_of_list);
 
138
    last= &(*last)->next;
 
139
    elements++;
 
140
  }
 
141
  void push_back(void *info, memory::Root *mem_root)
 
142
  {
 
143
    *last = new (mem_root) list_node(info, &end_of_list);
 
144
    last= &(*last)->next;
 
145
    elements++;
 
146
  }
 
147
  void push_front(void *info)
156
148
  {
157
149
    list_node *node=new list_node(info,first);
158
 
    if (node)
159
 
    {
160
 
      if (last == &first)
161
 
        last= &node->next;
 
150
    if (last == &first)
 
151
                        last= &node->next;
162
152
      first=node;
163
153
      elements++;
164
 
      return 0;
165
 
    }
166
 
    return 1;
167
154
  }
168
155
  void remove(list_node **prev)
169
156
  {
345
332
  List() {}
346
333
  List(const List<T> &tmp) : base_list(tmp) {}
347
334
  List(const List<T> &tmp, memory::Root *mem_root) : base_list(tmp, mem_root) {}
348
 
  bool push_back(T *a) { return base_list::push_back(a); }
349
 
  bool push_back(T *a, memory::Root *mem_root) { return base_list::push_back(a, mem_root); }
350
 
  bool push_front(T *a) { return base_list::push_front(a); }
 
335
  void push_back(T *a) { base_list::push_back(a); }
 
336
  void push_back(T *a, memory::Root *mem_root) { base_list::push_back(a, mem_root); }
 
337
  void push_front(T *a) { base_list::push_front(a); }
351
338
  T& front() {return *static_cast<T*>(first->info); }
352
339
  T* pop()  {return static_cast<T*>(base_list::pop()); }
353
340
  void concat(List<T> *list) { base_list::concat(list); }