~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_list.h

  • Committer: mordred
  • Date: 2008-11-01 00:46:20 UTC
  • mto: (572.1.1 devel) (575.1.1 devel)
  • mto: This revision was merged to the branch mainline in revision 573.
  • Revision ID: mordred@opensolaris-20081101004620-vd0kzsl9k40hvf4p
Some updates to dtrace support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef INCLUDES_DRIZZLE_SQL_LIST_H
21
 
#define INCLUDES_DRIZZLE_SQL_LIST_H
22
 
 
23
 
 
24
 
#ifdef USE_PRAGMA_INTERFACE
25
 
#pragma interface                       /* gcc class implementation */
26
 
#endif
 
20
#ifndef DRIZZLED_SQL_LIST_H
 
21
#define DRIZZLED_SQL_LIST_H
 
22
 
27
23
 
28
24
#include <utility>
29
25
#include <algorithm>
 
26
#include <drizzled/sql_alloc.h>
30
27
 
31
28
/** Struct to handle simple linked lists. */
32
29
typedef struct st_sql_list {
70
67
  }
71
68
} SQL_LIST;
72
69
 
73
 
/* mysql standard class memory allocator */
74
 
class Sql_alloc
75
 
{
76
 
public:
77
 
  static void *operator new(size_t size) throw ()
78
 
  {
79
 
    return sql_alloc(size);
80
 
  }
81
 
  static void *operator new[](size_t size)
82
 
  {
83
 
    return sql_alloc(size);
84
 
  }
85
 
  static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
86
 
  { return alloc_root(mem_root, size); }
87
 
  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
88
 
  { return alloc_root(mem_root, size); }
89
 
  static void operator delete(void *ptr __attribute__((unused)),
90
 
                              size_t size __attribute__((unused)))
91
 
  { TRASH(ptr, size); }
92
 
  static void operator delete(void *ptr __attribute__((unused)),
93
 
                              MEM_ROOT *mem_root __attribute__((unused)))
94
 
  { /* never called */ }
95
 
  static void operator delete[](void *ptr __attribute__((unused)),
96
 
                                MEM_ROOT *mem_root __attribute__((unused)))
97
 
  { /* never called */ }
98
 
  static void operator delete[](void *ptr __attribute__((unused)),
99
 
                                size_t size __attribute__((unused)))
100
 
  { TRASH(ptr, size); }
101
 
#ifdef HAVE_purify
102
 
  bool dummy;
103
 
  inline Sql_alloc() :dummy(0) {}
104
 
  inline ~Sql_alloc() {}
105
 
#else
106
 
  inline Sql_alloc() {}
107
 
  inline ~Sql_alloc() {}
108
 
#endif
109
 
 
110
 
};
111
 
 
112
 
 
113
70
/*
114
71
  Basic single linked list
115
72
  Used for item and item_buffs.
494
451
 
495
452
/*
496
453
  A simple intrusive list which automaticly removes element from list
497
 
  on delete (for THD element)
 
454
  on delete (for Session element)
498
455
*/
499
456
 
500
457
struct ilink
642
599
  Evidently not all template arguments have clone() method with
643
600
  the right signature.
644
601
 
645
 
  @return You must query the error state in THD for out-of-memory
 
602
  @return You must query the error state in Session for out-of-memory
646
603
  situation after calling this function.
647
604
*/
648
605
 
658
615
    it.replace(el->clone(mem_root));
659
616
}
660
617
 
661
 
#endif // INCLUDES_DRIZZLE_SQL_LIST_H
 
618
#endif // DRIZZLED_SQL_LIST_H