aboutsummaryrefslogtreecommitdiffstats
path: root/gc/include/gc_cpp.h
diff options
context:
space:
mode:
Diffstat (limited to 'gc/include/gc_cpp.h')
-rw-r--r--gc/include/gc_cpp.h56
1 files changed, 26 insertions, 30 deletions
diff --git a/gc/include/gc_cpp.h b/gc/include/gc_cpp.h
index ceb73f5..2b3a138 100644
--- a/gc/include/gc_cpp.h
+++ b/gc/include/gc_cpp.h
@@ -159,12 +159,18 @@ enum GCPlacement {UseGC,
class gc {public:
inline void* operator new( size_t size );
inline void* operator new( size_t size, GCPlacement gcp );
+ inline void* operator new( size_t size, void *p );
+ /* Must be redefined here, since the other overloadings */
+ /* hide the global definition. */
inline void operator delete( void* obj );
+ inline void operator delete( void*, void* );
#ifdef GC_OPERATOR_NEW_ARRAY
inline void* operator new[]( size_t size );
inline void* operator new[]( size_t size, GCPlacement gcp );
+ inline void* operator new[]( size_t size, void *p );
inline void operator delete[]( void* obj );
+ inline void gc::operator delete[]( void*, void* );
#endif /* GC_OPERATOR_NEW_ARRAY */
};
/*
@@ -211,7 +217,6 @@ inline void* operator new(
classes derived from "gc_cleanup" or containing members derived
from "gc_cleanup". */
-#ifdef GC_OPERATOR_NEW_ARRAY
#ifdef _MSC_VER
/** This ensures that the system default operator new[] doesn't get
@@ -220,42 +225,24 @@ inline void* operator new(
* There seems to be really redirect new in this environment without
* including this everywhere.
*/
- inline void *operator new[]( size_t size )
- {
- return GC_MALLOC_UNCOLLECTABLE( size );
- }
-
- inline void operator delete[](void* obj)
- {
- GC_FREE(obj);
- };
-
- inline void* operator new( size_t size)
- {
- return GC_MALLOC_UNCOLLECTABLE( size);
- };
+ void *operator new[]( size_t size );
+
+ void operator delete[](void* obj);
- inline void operator delete(void* obj)
- {
- GC_FREE(obj);
- };
+ void* operator new( size_t size);
+ void operator delete(void* obj);
-// This new operator is used by VC++ in case of Debug builds !
- inline void* operator new( size_t size,
+ // This new operator is used by VC++ in case of Debug builds !
+ void* operator new( size_t size,
int ,//nBlockUse,
const char * szFileName,
- int nLine
- ) {
-# ifndef GC_DEBUG
- return GC_malloc_uncollectable( size );
-# else
- return GC_debug_malloc_uncollectable(size, szFileName, nLine);
-# endif
- }
-
+ int nLine );
#endif /* _MSC_VER */
+
+#ifdef GC_OPERATOR_NEW_ARRAY
+
inline void* operator new[](
size_t size,
GCPlacement gcp,
@@ -283,9 +270,13 @@ inline void* gc::operator new( size_t size, GCPlacement gcp ) {
else
return GC_MALLOC_UNCOLLECTABLE( size );}
+inline void* gc::operator new( size_t size, void *p ) {
+ return p;}
+
inline void gc::operator delete( void* obj ) {
GC_FREE( obj );}
+inline void gc::operator delete( void*, void* ) {}
#ifdef GC_OPERATOR_NEW_ARRAY
@@ -295,8 +286,13 @@ inline void* gc::operator new[]( size_t size ) {
inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
return gc::operator new( size, gcp );}
+inline void* gc::operator new[]( size_t size, void *p ) {
+ return p;}
+
inline void gc::operator delete[]( void* obj ) {
gc::operator delete( obj );}
+
+inline void gc::operator delete[]( void*, void* ) {}
#endif /* GC_OPERATOR_NEW_ARRAY */