~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_alloc.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-17 00:08:20 UTC
  • mto: (1126.9.3 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090917000820-urd6p46qngi1okjp
Updated calls to some dtrace probes to cast the parameter to const char *
appropriately. Also, removed the additional variable in places that I was
using.

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 DRIZZLED_MEMORY_SQL_ALLOC_H
21
 
#define DRIZZLED_MEMORY_SQL_ALLOC_H
22
 
 
23
 
#include <unistd.h>
24
 
#include "drizzled/memory/root.h"
25
 
 
26
 
namespace drizzled
27
 
{
 
20
#ifndef DRIZZLE_SERVER_SQL_ALLOC_H
 
21
#define DRIZZLE_SERVER_SQL_ALLOC_H
 
22
 
 
23
#include <mysys/my_alloc.h>
 
24
#include <mystrings/m_ctype.h>
 
25
 
28
26
class Session;
29
27
 
30
 
namespace memory
31
 
{
32
 
 
33
 
void init_sql_alloc(Root *root, size_t block_size, size_t pre_alloc_size);
 
28
void init_sql_alloc(MEM_ROOT *root, size_t block_size, size_t pre_alloc_size);
34
29
void *sql_alloc(size_t);
35
30
void *sql_calloc(size_t);
36
31
char *sql_strdup(const char *str);
37
32
char *sql_strmake(const char *str, size_t len);
38
33
void *sql_memdup(const void * ptr, size_t size);
 
34
void sql_element_free(void *ptr);
 
35
void sql_kill(Session *session, ulong id, bool only_kill_query);
 
36
char* query_table_status(Session *session,const char *db,const char *table_name);
39
37
 
40
 
class SqlAlloc
 
38
/* mysql standard class memory allocator */
 
39
class Sql_alloc
41
40
{
42
41
public:
43
 
  static void *operator new(size_t size);
44
 
  static void *operator new[](size_t size);
45
 
  static void *operator new[](size_t size, Root *mem_root);
46
 
  static void *operator new(size_t size, Root *mem_root);
 
42
  static void *operator new(size_t size) throw ()
 
43
  {
 
44
    return sql_alloc(size);
 
45
  }
 
46
  static void *operator new[](size_t size)
 
47
  {
 
48
    return sql_alloc(size);
 
49
  }
 
50
  static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
 
51
  { return alloc_root(mem_root, size); }
 
52
  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
 
53
  { return alloc_root(mem_root, size); }
47
54
  static void operator delete(void *, size_t)
48
55
  {  }
49
 
  static void operator delete(void *, Root *)
50
 
  {  }
51
 
  static void operator delete[](void *, Root *)
52
 
  {  }
 
56
  static void operator delete(void *, MEM_ROOT *)
 
57
  { /* never called */ }
 
58
  static void operator delete[](void *, MEM_ROOT *)
 
59
  { /* never called */ }
53
60
  static void operator delete[](void *, size_t)
54
61
  {  }
55
 
  SqlAlloc() {}
56
 
  /**
57
 
   * @TODO: Make this virtual... but List<> must be fixed first
58
 
   */
59
 
  ~SqlAlloc() {}
 
62
#ifdef HAVE_purify
 
63
  bool dummy;
 
64
  inline Sql_alloc() :dummy(0) {}
 
65
  inline ~Sql_alloc() {}
 
66
#else
 
67
  inline Sql_alloc() {}
 
68
  inline ~Sql_alloc() {}
 
69
#endif
60
70
 
61
71
};
62
72
 
63
 
}
64
 
}
65
 
 
66
 
#endif /* DRIZZLED_MEMORY_SQL_ALLOC_H */
 
73
#endif /* DRIZZLE_SERVER_SQL_ALLOC_H */