aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--externals/grill/flext/changes.txt1
-rw-r--r--externals/grill/flext/source/flout.cpp1
-rw-r--r--externals/grill/flext/source/flsupport.cpp4
-rw-r--r--externals/grill/flext/source/flsupport.h33
4 files changed, 29 insertions, 10 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index b554af1e..6c862aaa 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -22,6 +22,7 @@ Version history:
- cleaned up internals (like Max/MSP typedefs)
- fixed coexistence of message and signal objects in Max/MSP object libraries
- fixes for pthreads version 2
+- deprecated FLEXT_GLOBALNEW in favor of FLEXT_USECMEM (either global new/delete operators or C library memory allocation)
0.5.0:
- fixes for 64 bit builds (size_t is integer type of pointer size)
diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp
index d4066568..c95bf8fa 100644
--- a/externals/grill/flext/source/flout.cpp
+++ b/externals/grill/flext/source/flout.cpp
@@ -104,6 +104,7 @@ bool flext_base::InitInlets()
// this is on a per-class basis... we cannot really use it here
// if(xi.desc && *xi.desc) class_settip(thisClass(),gensym(xi.desc));
#endif
+ inlets[0] = NULL;
}
for(int ix = 1; ix < incnt; ++ix,++cnt) {
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index a05f2b04..3443eb46 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -104,6 +104,8 @@ void flext::Setup()
#define LARGEALLOC 32000
+#ifndef FLEXT_USECMEM
+
#ifdef FLEXT_DEBUGMEM
static const size_t memtest = 0x12345678L;
#endif
@@ -192,6 +194,8 @@ bool flext_root::MemCheck(void *blk)
}
#endif
+#endif
+
void *flext_root::NewAligned(size_t bytes,int bitalign)
{
const size_t ovh = sizeof(size_t)+sizeof(char *);
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 87e198f8..eb358647 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -46,6 +46,20 @@ public:
@{
*/
+#ifdef FLEXT_NOGLOBALNEW
+#error FLEXT_NOGLOBALNEW is deprecated, define FLEXT_USECMEM instead
+#define FLEXT_USECMEM
+#endif
+
+#ifdef FLEXT_USECMEM
+ inline void *operator new(size_t bytes) { return ::operator new(bytes); }
+ inline void operator delete(void *blk) { ::operator delete(blk); }
+
+ inline void *operator new[](size_t bytes) { return ::operator new[](bytes); }
+ inline void operator delete[](void *blk) { ::operator delete[](blk); }
+
+ static bool MemCheck(void *) { return true; }
+#else
/*! Overloaded new memory allocation method
\note this uses a fast allocation method of the real-time system
\warning Max/MSP (or MacOS) allows only 32K in overdrive mode!
@@ -54,9 +68,9 @@ public:
//! Overloaded delete method
void operator delete(void *blk);
-#ifndef __BORLANDC__
- inline void *operator new(size_t,void *p) { return p; }
- inline void operator delete(void *,void *) {}
+#ifndef __MRC__ // doesn't allow new[] overloading?!
+ inline void *operator new[](size_t bytes) { return operator new(bytes); }
+ inline void operator delete[](void *blk) { operator delete(blk); }
#endif
#ifdef FLEXT_DEBUGMEM
@@ -65,11 +79,12 @@ public:
static bool MemCheck(void *) { return true; }
#endif
-#ifndef __MRC__ // doesn't allow new[] overloading?!
- inline void *operator new[](size_t bytes) { return operator new(bytes); }
- inline void operator delete[](void *blk) { operator delete(blk); }
+#endif // USECMEM
#ifndef __BORLANDC__
+ inline void *operator new(size_t,void *p) { return p; }
+ inline void operator delete(void *,void *) {}
+#ifndef __MRC__
inline void *operator new[](size_t,void *p) { return p; }
inline void operator delete[](void *,void *) {}
#endif
@@ -89,7 +104,7 @@ public:
//! @} FLEXT_S_MEMORY
};
-#ifndef FLEXT_NOGLOBALNEW
+#ifndef FLEXT_USECMEM
/************************************************************************/
// MFC doesn't like global overloading of allocators
// anyway, who likes MFC
@@ -110,7 +125,7 @@ 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
+#endif // FLEXT_USECMEM
/************************************************************************/
@@ -792,8 +807,6 @@ public:
static bool IsThread(thrid_t t,thrid_t ref = GetThreadId()) {
#if FLEXT_THREADS == FLEXT_THR_POSIX
return pthread_equal(ref,t) != 0;
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- return ref == t;
#else
return ref == t;
#endif