Make operator new / delete weak
so you can implement your own, e.g. if you need a throwing operator new.
This commit is contained in:
parent
233f9a6a31
commit
2985d1d11e
1 changed files with 4 additions and 4 deletions
|
@ -4,22 +4,22 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void *operator new(size_t size)
|
||||
void * __attribute__((weak)) operator new(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void *operator new[](size_t size)
|
||||
void * __attribute__((weak)) operator new[](size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void operator delete(void * ptr)
|
||||
void __attribute__((weak)) operator delete(void * ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void * ptr)
|
||||
void __attribute__((weak)) operator delete[](void * ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue