~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_list.h

  • Committer: Monty Taylor
  • Date: 2008-10-05 01:41:06 UTC
  • Revision ID: monty@inaugust.com-20081005014106-bulqe4kp7i6ipts1
Moved qsort declarations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define INCLUDES_DRIZZLE_SQL_LIST_H
22
22
 
23
23
 
 
24
#ifdef USE_PRAGMA_INTERFACE
 
25
#pragma interface                       /* gcc class implementation */
 
26
#endif
 
27
 
24
28
#include <utility>
25
29
#include <algorithm>
26
30
 
27
31
/** Struct to handle simple linked lists. */
28
32
typedef struct st_sql_list {
29
 
  uint32_t elements;
30
 
  unsigned char *first;
31
 
  unsigned char **next;
 
33
  uint elements;
 
34
  uchar *first;
 
35
  uchar **next;
32
36
 
33
37
  st_sql_list() {}                              /* Remove gcc warning */
34
38
  inline void empty()
37
41
    first=0;
38
42
    next= &first;
39
43
  }
40
 
  inline void link_in_list(unsigned char *element,unsigned char **next_ptr)
 
44
  inline void link_in_list(uchar *element,uchar **next_ptr)
41
45
  {
42
46
    elements++;
43
47
    (*next)=element;
145
149
  list_node *first,**last;
146
150
 
147
151
public:
148
 
  uint32_t elements;
 
152
  uint elements;
149
153
 
150
154
  inline void empty() { elements=0; first= &end_of_list; last=&first;}
151
155
  inline base_list() { empty(); }
296
300
  {
297
301
    base_list *list= this;
298
302
    list_node *node= first;
299
 
    uint32_t cnt= 0;
 
303
    uint cnt= 0;
300
304
 
301
305
    while (node->next != &end_of_list)
302
306
    {
336
340
protected:
337
341
  base_list *list;
338
342
  list_node **el,**prev,*current;
339
 
  void sublist(base_list &ls, uint32_t elm)
 
343
  void sublist(base_list &ls, uint elm)
340
344
  {
341
345
    ls.first= *el;
342
346
    ls.last= list->last;
481
485
  inline void init(List<T> &a) { base_list_iterator::init(a); }
482
486
  inline T* operator++(int) { return (T*) base_list_iterator::next_fast(); }
483
487
  inline void rewind(void)  { base_list_iterator::rewind(); }
484
 
  void sublist(List<T> &list_arg, uint32_t el_arg)
 
488
  void sublist(List<T> &list_arg, uint el_arg)
485
489
  {
486
490
    base_list_iterator::sublist(list_arg, el_arg);
487
491
  }
503
507
  static void operator delete(void* ptr_arg,
504
508
                              size_t size __attribute__((unused)))
505
509
  {
506
 
     free((unsigned char*)ptr_arg);
 
510
     my_free((uchar*)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
507
511
  }
508
512
 
509
513
  inline ilink()