mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-02 13:24:12 +01:00
Add trivial new[] and delete[] operators (Justin R. Cutler)
Fixes #73 Fixes #883
This commit is contained in:
parent
27e6e8c80c
commit
141684d410
@ -5,10 +5,20 @@ void * operator new(size_t size)
|
|||||||
return malloc(size);
|
return malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void * operator new[](size_t size)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
void operator delete(void * ptr)
|
void operator delete(void * ptr)
|
||||||
{
|
{
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void operator delete[](void * ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);};
|
int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);};
|
||||||
void __cxa_guard_release (__guard *g) {*(char *)g = 1;};
|
void __cxa_guard_release (__guard *g) {*(char *)g = 1;};
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void * operator new(size_t size);
|
void * operator new(size_t size);
|
||||||
void operator delete(void * ptr);
|
void * operator new[](size_t size);
|
||||||
|
void operator delete(void * ptr);
|
||||||
|
void operator delete[](void * ptr);
|
||||||
|
|
||||||
__extension__ typedef int __guard __attribute__((mode (__DI__)));
|
__extension__ typedef int __guard __attribute__((mode (__DI__)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user