aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flsupport.h
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-12-10 21:34:08 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-12-10 21:34:08 +0000
commitd399ea9333e69c2506ba09754a8c1b8d292e9085 (patch)
tree706a0a20dbf2de36a423b871eed7081935dae0ed /externals/grill/flext/source/flsupport.h
parent8bbf9e95a3ef69860a442852d595601d5718f0f4 (diff)
some minor changes after valgrind run
fix uninitialized pointer With FLEXT_USECMEM normal C library memory allocation will be used, otherwise global operators will be overridden to use memory allocation by the real-time system (getbytes). more pthreads V2 fixes Deprecated FLEXT_NOGLOBALNEW in favor of FLEXT_USECMEM. svn path=/trunk/; revision=4184
Diffstat (limited to 'externals/grill/flext/source/flsupport.h')
-rw-r--r--externals/grill/flext/source/flsupport.h33
1 files changed, 23 insertions, 10 deletions
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