X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/184b5d99a5382cd7a19888c85aff11f8a21af2f6..e29b83a455bead3dae44300f631d07aa9635d3e9:/src/common/memory.cpp diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 37bf42aa41..e89bd8835c 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -49,7 +49,7 @@ # endif #endif -#if !defined(__WATCOMC__) && !defined(__VMS__) +#if !defined(__WATCOMC__) && !defined(__VMS__) && !defined( __MWERKS__ ) #include #endif @@ -532,6 +532,8 @@ bool wxDebugContext::SetFile(const wxString& file) bool wxDebugContext::SetStandardError(void) { + // Obsolete +#if 0 #if !defined(_WINDLL) wxDebugStreamBuf *buf = new wxDebugStreamBuf; ostream *stream = new ostream(m_streamBuf); @@ -540,6 +542,8 @@ bool wxDebugContext::SetStandardError(void) #else return FALSE; #endif +#endif + return FALSE; } @@ -902,11 +906,15 @@ int wxDebugContext::Check(bool checkAll) // Count the number of non-wxDebugContext-related objects // that are outstanding -int wxDebugContext::CountObjectsLeft(void) +int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint) { int n = 0; - - wxMemStruct *from = wxDebugContext::GetHead (); + + wxMemStruct *from = NULL; + if (sinceCheckpoint && checkPoint) + from = checkPoint->m_next; + else + from = wxDebugContext::GetHead () ; for (wxMemStruct * st = from; st != 0; st = st->m_next) { @@ -951,7 +959,28 @@ void * operator new (size_t size, char * fileName, int lineNum) #endif } -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) +// Added JACS 25/11/98 +void * operator new (size_t size) +{ +#ifdef NO_DEBUG_ALLOCATION + return malloc(size); +#else + return wxDebugAlloc(size, NULL, 0, FALSE); +#endif +} + +#if wxUSE_ARRAY_MEMORY_OPERATORS +void * operator new[] (size_t size) +{ +#ifdef NO_DEBUG_ALLOCATION + return malloc(size); +#else + return wxDebugAlloc(size, NULL, 0, FALSE, TRUE); +#endif +} +#endif + +#if wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size, char * fileName, int lineNum) { #ifdef NO_DEBUG_ALLOCATION @@ -986,7 +1015,7 @@ void operator delete[](void* pData, char* /* fileName */, int /* lineNum */) } #endif -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) +#if wxUSE_ARRAY_MEMORY_OPERATORS void operator delete[] (void * buf) { @@ -1011,7 +1040,8 @@ void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bo return (void *)malloc(size); } - char * buf = (char *) malloc(wxDebugContext::TotSize (size)); + int totSize = wxDebugContext::TotSize (size); + char * buf = (char *) malloc(totSize); if (!buf) { wxLogDebug("Call to malloc (%ld) failed.", (long)size); return 0;