X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d3b9f782ef3949f583e8ac53795d36787f044fc3..035fa7f78c8915a24114d26728fa805773f2c4b5:/src/common/memory.cpp diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 993b39a7a9..4253bae38e 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -16,7 +16,7 @@ #pragma hdrstop #endif -#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT +#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT #include "wx/memory.h" @@ -46,7 +46,7 @@ #include #include -#if wxUSE_THREADS && defined(__WXDEBUG__) +#if wxUSE_THREADS #define USE_THREADSAFE_MEMORY_ALLOCATION 1 #else #define USE_THREADSAFE_MEMORY_ALLOCATION 0 @@ -118,8 +118,9 @@ void wxMemStruct::ErrorMsg () */ int wxMemStruct::AssertList () { - if (wxDebugContext::GetHead () != 0 && ! (wxDebugContext::GetHead ())->AssertIt () || - wxDebugContext::GetTail () != 0 && ! wxDebugContext::GetTail ()->AssertIt ()) { + if ((wxDebugContext::GetHead() && !wxDebugContext::GetHead()->AssertIt()) || + (wxDebugContext::GetTail() && !wxDebugContext::GetTail()->AssertIt())) + { ErrorMsg ("Head or tail pointers trashed"); return 0; } @@ -575,18 +576,13 @@ void wxDebugContext::TraverseList (PmSFV func, wxMemStruct *from) */ bool wxDebugContext::PrintList (void) { -#ifdef __WXDEBUG__ TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : NULL)); return true; -#else - return false; -#endif } bool wxDebugContext::Dump(void) { -#ifdef __WXDEBUG__ { const wxChar* appName = wxT("application"); wxString appNameStr; @@ -608,12 +604,8 @@ bool wxDebugContext::Dump(void) OutputDumpLine(wxEmptyString); return true; -#else - return false; -#endif } -#ifdef __WXDEBUG__ struct wxDebugStatsStruct { long instanceCount; @@ -638,11 +630,9 @@ static wxDebugStatsStruct *InsertStatsStruct(wxDebugStatsStruct *head, wxDebugSt st->next = head; return st; } -#endif bool wxDebugContext::PrintStatistics(bool detailed) { -#ifdef __WXDEBUG__ { const wxChar* appName = wxT("application"); wxString appNameStr; @@ -729,10 +719,6 @@ bool wxDebugContext::PrintStatistics(bool detailed) OutputDumpLine(wxEmptyString); return true; -#else - (void)detailed; - return false; -#endif } bool wxDebugContext::PrintClasses(void) @@ -846,16 +832,16 @@ void wxDebugContext::OutputDumpLine(const wxChar *szFormat, ...) int count; va_list argptr; va_start(argptr, szFormat); - buf[sizeof(buf)/sizeof(wxChar)-1] = _T('\0'); + buf[WXSIZEOF(buf)-1] = wxT('\0'); // keep 3 bytes for a \r\n\0 - count = wxVsnprintf(buf, sizeof(buf)/sizeof(wxChar)-3, szFormat, argptr); + count = wxVsnprintf(buf, WXSIZEOF(buf)-3, szFormat, argptr); if ( count < 0 ) - count = sizeof(buf)/sizeof(wxChar)-3; - buf[count]=_T('\r'); - buf[count+1]=_T('\n'); - buf[count+2]=_T('\0'); + count = WXSIZEOF(buf)-3; + buf[count]=wxT('\r'); + buf[count+1]=wxT('\n'); + buf[count+2]=wxT('\0'); wxMessageOutputDebug dbgout; dbgout.Printf(buf); @@ -902,7 +888,6 @@ static MemoryCriticalSection memLocker; #endif // USE_THREADSAFE_MEMORY_ALLOCATION -#ifdef __WXDEBUG__ #if !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) #if wxUSE_GLOBAL_MEMORY_OPERATORS void * operator new (size_t size, wxChar * fileName, int lineNum) @@ -1049,8 +1034,6 @@ void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) free((char *)st); } -#endif // __WXDEBUG__ - // Trace: send output to the current debugging stream void wxTrace(const wxChar * ...) { @@ -1167,4 +1150,4 @@ void wxDebugContextDumpDelayCounter::DoDump() // least one cleanup counter object static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_One; -#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT +#endif // wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT