aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--externals/grill/flext/source/flsupport.cpp20
-rw-r--r--externals/grill/flext/source/flsupport.h4
2 files changed, 19 insertions, 5 deletions
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index d8bddd42..bcbd5b06 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -136,11 +136,14 @@ void *flext_root::operator new(size_t bytes)
bytes += sizeof(size_t);
char *blk;
+#ifdef FLEXT_NOGLOBALNEW
if(bytes >= LARGEALLOC) {
// use C library function for large memory blocks
blk = (char *)::operator new(bytes);
}
- else {
+ else
+#endif
+ {
//! \todo We need system locking here for secondary threads!
#if FLEXT_SYS == FLEXT_SYS_JMAX
@@ -159,11 +162,14 @@ void flext_root::operator delete(void *blk)
char *ori = (char *)blk-sizeof(size_t);
size_t bytes = *(size_t *)ori;
+#ifdef FLEXT_NOGLOBALNEW
if(bytes >= LARGEALLOC) {
// use C library function for large memory blocks
::operator delete(ori);
}
- else {
+ else
+#endif
+ {
//! \todo We need system locking here for secondary threads!
#if FLEXT_SYS == FLEXT_SYS_JMAX
@@ -181,11 +187,14 @@ void *flext_root::NewAligned(size_t bytes,int bitalign)
bytes += ovh+alignovh;
char *blk;
+#ifdef FLEXT_NOGLOBALNEW
if(bytes >= LARGEALLOC) {
// use C library function for large memory blocks
blk = (char *)::operator new(bytes);
}
- else {
+ else
+#endif
+ {
//! \todo We need system locking here for secondary threads!
#if FLEXT_SYS == FLEXT_SYS_JMAX
@@ -206,11 +215,14 @@ void flext_root::FreeAligned(void *blk)
char *ori = *(char **)((char *)blk-sizeof(size_t)-sizeof(char *));
size_t bytes = *(size_t *)((char *)blk-sizeof(size_t));
+#ifdef FLEXT_NOGLOBALNEW
if(bytes >= LARGEALLOC) {
// use C library function for large memory blocks
::operator delete(ori);
}
- else {
+ else
+#endif
+ {
//! \todo We need system locking here for secondary threads!
#if FLEXT_SYS == FLEXT_SYS_JMAX
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 79122ed2..d2a8cb90 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -69,7 +69,7 @@ public:
//! @} FLEXT_S_MEMORY
};
-
+#ifndef FLEXT_NOGLOBALNEW
/************************************************************************/
// MFC doesn't like global overloading of allocators
// anyway, who likes MFC
@@ -90,6 +90,8 @@ inline void *operator new[](size_t bytes) NEWTHROW { return flext_root::operator
inline void operator delete[](void *blk) DELTHROW { flext_root::operator delete[](blk); }
#endif
+#endif // FLEXT_NOGLOBALNEW
+
/************************************************************************/