version 1.1.2.1, 2008/09/25 00:15:01
|
version 1.1.2.2, 2008/10/23 18:58:28
|
|
|
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <stdlib.h> | #include <stdlib.h> |
#include <malloc.h> | #include <malloc.h> |
|
|
#if defined(__cplusplus) | #if defined(__cplusplus) |
# include <new> | # include <new> |
|
#endif |
| |
extern "C" PEGASUS_COMMON_LINKAGE void* pegasus_malloc(size_t size); |
#if defined(__cplusplus) |
extern "C" PEGASUS_COMMON_LINKAGE void (*pegasus_malloc_notifier)(size_t total); |
extern "C" |
extern "C" PEGASUS_COMMON_LINKAGE void* pegasus_realloc(void* ptr, size_t size); |
|
extern "C" PEGASUS_COMMON_LINKAGE void pegasus_free(void* ptr); |
|
|
|
inline void* operator new(size_t size) throw(std::bad_alloc) |
|
{ |
|
return pegasus_malloc(size); |
|
} |
|
|
|
inline void* operator new[](size_t size) throw(std::bad_alloc) |
|
{ |
|
return pegasus_malloc(size); |
|
} |
|
|
|
inline void operator delete(void* ptr) |
|
{ |
|
pegasus_free(ptr); |
|
} |
|
|
|
inline void operator delete[](void* ptr) |
|
{ |
|
pegasus_free(ptr); |
|
} |
|
|
|
inline void operator delete(void* ptr, size_t) |
|
{ |
|
pegasus_free(ptr); |
|
} |
|
|
|
inline void operator delete[](void* ptr, size_t) |
|
{ | { |
pegasus_free(ptr); |
#endif |
} |
|
|
|
#else /* defined(__cplusplus) */ |
|
| |
PEGASUS_COMMON_LINKAGE void* pegasus_malloc(size_t size); | PEGASUS_COMMON_LINKAGE void* pegasus_malloc(size_t size); |
PEGASUS_COMMON_LINKAGE void (*pegasus_malloc_notifier)(size_t total); |
|
PEGASUS_COMMON_LINKAGE void* pegasus_realloc(void* ptr, size_t size); | PEGASUS_COMMON_LINKAGE void* pegasus_realloc(void* ptr, size_t size); |
PEGASUS_COMMON_LINKAGE void pegasus_free(void* ptr); | PEGASUS_COMMON_LINKAGE void pegasus_free(void* ptr); |
|
PEGASUS_COMMON_LINKAGE void pegasus_free(void* ptr); |
|
|
|
#if defined(__cplusplus) |
|
} |
|
#endif |
| |
#endif /* !defined(__cplusplus) */ |
extern PEGASUS_COMMON_LINKAGE void (*pegasus_malloc_notifier)(size_t total); |
| |
#ifndef PEGASUS_INSIDE_ALLOC_CPP | #ifndef PEGASUS_INSIDE_ALLOC_CPP |
# define malloc pegasus_malloc | # define malloc pegasus_malloc |