summaryrefslogtreecommitdiff
path: root/storage/ndb/src/common/util/new.cpp
blob: 643800f15828d715de6a7b189b318a8da32a1a43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

#include <ndb_global.h>
#include <NdbMem.h>

extern "C" {
  void (* ndb_new_handler)() = 0;
}

#if 0

void *operator new (size_t sz)
{
  void * p = NdbMem_Allocate(sz ? sz : 1);
  if(p)
    return p;
  if(ndb_new_handler)
    (* ndb_new_handler)();
  abort();
}

void *operator new[] (size_t sz)
{
  void * p = (void *) NdbMem_Allocate(sz ? sz : 1);
  if(p)
    return p;
  if(ndb_new_handler)
    (* ndb_new_handler)();
  abort();
}

void operator delete (void *ptr)
{
  if (ptr)
    NdbMem_Free(ptr);
}

void operator delete[] (void *ptr) throw ()
{
  if (ptr)
    NdbMem_Free(ptr);
}

#endif // USE_MYSYS_NEW