~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/sql_list.h

  • Committer: Brian Aker
  • Date: 2008-07-14 04:46:28 UTC
  • Revision ID: brian@tangent.org-20080714044628-mk3nt2rbaeqt8oe9
Removed oddball types in my_global.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifdef USE_PRAGMA_INTERFACE
20
20
#pragma interface                       /* gcc class implementation */
21
21
#endif
22
 
                                  
23
 
/** Struct to handle simple linked lists. */
24
 
typedef struct st_sql_list {
25
 
  uint elements;
26
 
  uchar *first;
27
 
  uchar **next;
28
 
 
29
 
  st_sql_list() {}                              /* Remove gcc warning */
30
 
  inline void empty()
31
 
  {
32
 
    elements=0;
33
 
    first=0;
34
 
    next= &first;
35
 
  }
36
 
  inline void link_in_list(uchar *element,uchar **next_ptr)
37
 
  {
38
 
    elements++;
39
 
    (*next)=element;
40
 
    next= next_ptr;
41
 
    *next=0;
42
 
  }
43
 
  inline void save_and_clear(struct st_sql_list *save)
44
 
  {
45
 
    *save= *this;
46
 
    empty();
47
 
  }
48
 
  inline void push_front(struct st_sql_list *save)
49
 
  {
50
 
    *save->next= first;                         /* link current list last */
51
 
    first= save->first;
52
 
    elements+= save->elements;
53
 
  }
54
 
  inline void push_back(struct st_sql_list *save)
55
 
  {
56
 
    if (save->first)
57
 
    {
58
 
      *next= save->first;
59
 
      next= save->next;
60
 
      elements+= save->elements;
61
 
    }
62
 
  }
63
 
} SQL_LIST;
64
22
 
65
23
/* mysql standard class memory allocator */
 
24
 
66
25
class Sql_alloc
67
26
{
68
27
public:
78
37
  { return alloc_root(mem_root, size); }
79
38
  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
80
39
  { return alloc_root(mem_root, size); }
81
 
  static void operator delete(void *ptr __attribute__((unused)),
82
 
                              size_t size __attribute__((unused)))
 
40
  static void operator delete(void *ptr __attribute__((__unused__)),
 
41
                              size_t size __attribute__((__unused__)))
83
42
  { TRASH(ptr, size); }
84
 
  static void operator delete(void *ptr __attribute__((unused)),
85
 
                              MEM_ROOT *mem_root __attribute__((unused)))
86
 
  { /* never called */ }
87
 
  static void operator delete[](void *ptr __attribute__((unused)),
88
 
                                MEM_ROOT *mem_root __attribute__((unused)))
89
 
  { /* never called */ }
90
 
  static void operator delete[](void *ptr __attribute__((unused)),
91
 
                                size_t size __attribute__((unused)))
 
43
  static void operator delete(void *ptr __attribute__((__unused__)),
 
44
                              MEM_ROOT *mem_root __attribute__((__unused__)))
 
45
  { /* never called */ }
 
46
  static void operator delete[](void *ptr __attribute__((__unused__)),
 
47
                                MEM_ROOT *mem_root __attribute__((__unused__)))
 
48
  { /* never called */ }
 
49
  static void operator delete[](void *ptr __attribute__((__unused__)),
 
50
                                size_t size __attribute__((__unused__)))
92
51
  { TRASH(ptr, size); }
93
52
#ifdef HAVE_purify
94
53
  bool dummy;
167
126
    list_copy_and_replace_each_value after creating a copy.
168
127
  */
169
128
  base_list(const base_list &rhs, MEM_ROOT *mem_root);
170
 
  inline base_list(bool error __attribute__((unused))) { }
 
129
  inline base_list(bool error __attribute__((__unused__))) { }
171
130
  inline bool push_back(void *info)
172
131
  {
173
132
    if (((*last)=new list_node(info, &end_of_list)))
465
424
template <class T> class List_iterator_fast :public base_list_iterator
466
425
{
467
426
protected:
468
 
  inline T *replace(T *a __attribute__((unused)))   { return (T*) 0; }
469
 
  inline T *replace(List<T> &a __attribute__((unused))) { return (T*) 0; }
 
427
  inline T *replace(T *a __attribute__((__unused__)))   { return (T*) 0; }
 
428
  inline T *replace(List<T> &a __attribute__((__unused__))) { return (T*) 0; }
470
429
  inline void remove(void)  { }
471
 
  inline void after(T *a __attribute__((unused)))   { }
 
430
  inline void after(T *a __attribute__((__unused__)))   { }
472
431
  inline T** ref(void)      { return (T**) 0; }
473
432
 
474
433
public:
497
456
    return (void*)my_malloc((uint)size, MYF(MY_WME | MY_FAE | ME_FATALERROR));
498
457
  }
499
458
  static void operator delete(void* ptr_arg,
500
 
                              size_t size __attribute__((unused)))
 
459
                              size_t size __attribute__((__unused__)))
501
460
  {
502
461
     my_free((uchar*)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
503
462
  }