#include <string>
#include <new>
#include <cxxabi.h>
-#endif // MEMLEAK_CHECK
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef SWIG
-#define CHECKFORMAT __attribute__ ((__format__(__printf__, 1, 2)))
-#else
-#define CHECKFORMAT
-#endif
-
-void CHECKFORMAT eFatal(const char*, ...);
-
-enum { lvlDebug=1, lvlWarning=2, lvlFatal=4 };
-
-#ifndef SWIG
-extern Signal2<void, int, const std::string&> logOutput;
-extern int logOutputConsole;
-#endif
-
-#ifdef ASSERT
-#undef ASSERT
-#endif
-
-#ifdef DEBUG
- void CHECKFORMAT eDebug(const char*, ...);
- void CHECKFORMAT eDebugNoNewLine(const char*, ...);
- void CHECKFORMAT eWarning(const char*, ...);
-#ifndef SWIG
- #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); }
-#endif
-
-#ifdef MEMLEAK_CHECK
typedef struct
{
unsigned int address;
unsigned int size;
- char *file;
+ const char *file;
void *backtrace[BACKTRACE_DEPTH];
unsigned char btcount;
unsigned short line;
allocList = new(AllocList);
info.address = addr;
- info.file = strdup(fname);
+ info.file = fname;
info.line = lnum;
info.size = asize;
info.type = type;
- info.btcount = backtrace( info.backtrace, BACKTRACE_DEPTH );
+ info.btcount = 0; //backtrace( info.backtrace, BACKTRACE_DEPTH );
singleLock s(memLock);
(*allocList)[addr]=info;
};
if ( i->second.type != type )
i->second.type=3;
else
- {
- free(i->second.file);
allocList->erase(i);
- }
}
};
-inline void * operator new(unsigned int size, const char *file, int line)
+inline void * operator new(size_t size, const char *file, int line)
{
void *ptr = (void *)malloc(size);
AddTrack((unsigned int)ptr, size, file, line, 1);
free(p);
};
-inline void * operator new[](unsigned int size, const char *file, int line)
+inline void * operator new[](size_t size, const char *file, int line)
{
void *ptr = (void *)malloc(size);
AddTrack((unsigned int)ptr, size, file, line, 2);
#endif // MEMLEAK_CHECK
-#else
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifdef ASSERT
+#undef ASSERT
+#endif
+
+#ifndef SWIG
+
+#define CHECKFORMAT __attribute__ ((__format__(__printf__, 1, 2)))
+
+extern Signal2<void, int, const std::string&> logOutput;
+extern int logOutputConsole;
+
+void CHECKFORMAT eFatal(const char*, ...);
+enum { lvlDebug=1, lvlWarning=2, lvlFatal=4 };
+
+#ifdef DEBUG
+ void CHECKFORMAT eDebug(const char*, ...);
+ void CHECKFORMAT eDebugNoNewLine(const char*, ...);
+ void CHECKFORMAT eWarning(const char*, ...);
+ #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); }
+#else // DEBUG
inline void eDebug(const char* fmt, ...)
{
}
#define ASSERT(x) do { } while (0)
#endif //DEBUG
-void ePythonOutput(const char *);
void eWriteCrashdump();
+#endif // SWIG
+
+void ePythonOutput(const char *);
+
#endif // __E_ERROR__