*/
void wxMemStruct::ErrorMsg (const char * mesg)
{
- wxLogMessage(wxT("wxWindows memory checking error: %s"), mesg);
+ wxLogMessage(wxT("wxWidgets memory checking error: %s"), mesg);
PrintNode ();
}
*/
void wxMemStruct::ErrorMsg ()
{
- wxLogMessage(wxT("wxWindows over/underwrite memory error:"));
+ wxLogMessage(wxT("wxWidgets over/underwrite memory error:"));
PrintNode ();
}
// Let's put this in standard form so IDEs can load the file at the appropriate
// line
- wxString msg(wxT(""));
+ wxString msg;
if (m_fileName)
msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum);
}
else
{
- wxString msg(wxT(""));
+ wxString msg;
if (m_fileName)
msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum);
{
wxObject *obj = (wxObject *)m_actualData;
- wxString msg(wxT(""));
+ wxString msg;
if (m_fileName)
msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum);
else
msg += wxT("unknown object class");
- wxString msg2(wxT(""));
+ wxString msg2;
msg2.Printf(wxT(" at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize());
msg += msg2;
}
else
{
- wxString msg(wxT(""));
+ wxString msg;
if (m_fileName)
msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum);
- wxString msg2(wxT(""));
+ wxString msg2;
msg2.Printf(wxT("non-object data at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize() );
msg += msg2;
wxDebugContext::OutputDumpLine(msg);
wxMemStruct *wxDebugContext::m_head = NULL;
wxMemStruct *wxDebugContext::m_tail = NULL;
-bool wxDebugContext::m_checkPrevious = FALSE;
+bool wxDebugContext::m_checkPrevious = false;
int wxDebugContext::debugLevel = 1;
-bool wxDebugContext::debugOn = TRUE;
+bool wxDebugContext::debugOn = true;
wxMemStruct *wxDebugContext::checkPoint = NULL;
// For faster alignment calculation
#ifdef __WXDEBUG__
TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL));
- return TRUE;
+ return true;
#else
- return FALSE;
+ return false;
#endif
}
#ifdef __WXDEBUG__
{
wxChar* appName = (wxChar*) wxT("application");
- wxString appNameStr(wxT(""));
+ wxString appNameStr;
if (wxTheApp)
{
appNameStr = wxTheApp->GetAppName();
TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL));
- OutputDumpLine( wxT("") );
- OutputDumpLine( wxT("") );
+ OutputDumpLine(wxEmptyString);
+ OutputDumpLine(wxEmptyString);
- return TRUE;
+ return true;
#else
- return FALSE;
+ return false;
#endif
}
#ifdef __WXDEBUG__
{
wxChar* appName = (wxChar*) wxT("application");
- wxString appNameStr(wxT(""));
+ wxString appNameStr;
if (wxTheApp)
{
appNameStr = wxTheApp->GetAppName();
}
bool currentMode = GetDebugMode();
- SetDebugMode(FALSE);
+ SetDebugMode(false);
long noNonObjectNodes = 0;
long noObjectNodes = 0;
list = old->next;
free((char *)old);
}
- OutputDumpLine(wxT(""));
+ OutputDumpLine(wxEmptyString);
}
SetDebugMode(currentMode);
OutputDumpLine(wxT("Number of object items: %ld"), noObjectNodes);
OutputDumpLine(wxT("Number of non-object items: %ld"), noNonObjectNodes);
OutputDumpLine(wxT("Total allocated size: %ld"), totalSize);
- OutputDumpLine(wxT(""));
- OutputDumpLine(wxT(""));
+ OutputDumpLine(wxEmptyString);
+ OutputDumpLine(wxEmptyString);
- return TRUE;
+ return true;
#else
(void)detailed;
- return FALSE;
+ return false;
#endif
}
{
{
wxChar* appName = (wxChar*) wxT("application");
- wxString appNameStr(wxT(""));
+ wxString appNameStr;
if (wxTheApp)
{
appNameStr = wxTheApp->GetAppName();
node = wxClassInfo::sm_classTable->Next();
n ++;
}
- wxLogMessage(wxT(""));
+ wxLogMessage(wxEmptyString);
wxLogMessage(wxT("There are %d classes derived from wxObject."), n);
- wxLogMessage(wxT(""));
- wxLogMessage(wxT(""));
- return TRUE;
+ wxLogMessage(wxEmptyString);
+ wxLogMessage(wxEmptyString);
+ return true;
}
void wxDebugContext::SetCheckpoint(bool all)
#if USE_THREADSAFE_MEMORY_ALLOCATION
-static bool memSectionOk = FALSE;
+static bool memSectionOk = false;
class MemoryCriticalSection : public wxCriticalSection
{
public:
- MemoryCriticalSection() {
- memSectionOk = TRUE;
- }
+ MemoryCriticalSection() {
+ memSectionOk = true;
+ }
};
class MemoryCriticalSectionLocker
{
public:
inline MemoryCriticalSectionLocker(wxCriticalSection& critsect)
- : m_critsect(critsect), m_locked(memSectionOk) { if(m_locked) m_critsect.Enter(); }
+ : m_critsect(critsect), m_locked(memSectionOk) { if(m_locked) m_critsect.Enter(); }
inline ~MemoryCriticalSectionLocker() { if(m_locked) m_critsect.Leave(); }
private:
MemoryCriticalSectionLocker& operator=(const MemoryCriticalSectionLocker&);
wxCriticalSection& m_critsect;
- bool m_locked;
+ bool m_locked;
};
-static MemoryCriticalSection memLocker;
+MemoryCriticalSection &GetMemLocker()
+{
+ static MemoryCriticalSection memLocker;
+ return memLocker;
+}
+
#endif
// TODO: store whether this is a vector or not.
void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) )
{
#if USE_THREADSAFE_MEMORY_ALLOCATION
- MemoryCriticalSectionLocker lock(memLocker);
+ MemoryCriticalSectionLocker lock(GetMemLocker());
#endif
// If not in debugging allocation mode, do the normal thing
void wxDebugFree(void * buf, bool WXUNUSED(isVect) )
{
#if USE_THREADSAFE_MEMORY_ALLOCATION
- MemoryCriticalSectionLocker lock(memLocker);
+ MemoryCriticalSectionLocker lock(GetMemLocker());
#endif
if (!buf)
void wxDebugContextDumpDelayCounter::DoDump()
{
- if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
+ if (wxDebugContext::CountObjectsLeft(true) > 0)
{
wxDebugContext::OutputDumpLine(wxT("There were memory leaks.\n"));
wxDebugContext::Dump();