#include "wx/app.h"
#endif
-#include <wx/log.h>
+#include "wx/log.h"
#include <stdlib.h>
#include "wx/ioswrap.h"
#include <fstream>
#endif
-#if !defined(__WATCOMC__) && !defined(__VMS__) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
+#if !defined(__WATCOMC__) && !(defined(__VMS__) && ( __VMS_VER < 70000000 ) )\
+ && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
#include <memory.h>
#endif
bool wxDebugContext::debugOn = TRUE;
wxMemStruct *wxDebugContext::checkPoint = NULL;
+// For faster alignment calculation
+static wxMarkerType markerCalc[2];
+int wxDebugContext::m_balign = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]);
+int wxDebugContext::m_balignmask = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]) - 1;
+
wxDebugContext::wxDebugContext(void)
{
// m_streamBuf = new wxDebugStreamBuf;
I don't know how portable this stuff is, but it seems to work for me at
the moment. It would be real nice if I knew more about this!
+
+ // Note: this function is now obsolete (along with CalcAlignment)
+ // because the calculations are done statically, for greater speed.
*/
size_t wxDebugContext::GetPadding (const size_t size)
{
return (pad) ? sizeof(wxMarkerType) - pad : 0;
}
-
-
size_t wxDebugContext::PaddedSize (const size_t size)
{
+ // Added by Terry Farnham <TJRT@pacbell.net> to replace
+ // slow GetPadding call.
+ int padb;
+
+ padb = size & m_balignmask;
+ if(padb)
+ return(size + m_balign - padb);
+ else
+ return(size);
+
+// Old (slow) code
+#if 0
return size + GetPadding (size);
+#endif
}
/*
}
#endif
+#if !defined(__VISAGECPP__) // already defines this by default
void operator delete (void * buf)
{
#ifdef NO_DEBUG_ALLOCATION
wxDebugFree(buf);
#endif
}
+#endif
// VC++ 6.0
#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */)
{
-// ::operator delete(pData);
- // JACS 21/11/1998: surely we need to call wxDebugFree?
wxDebugFree(pData, FALSE);
}
// New operator 21/11/1998