diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-08-17 13:13:53 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-08-17 13:13:53 +0000 |
| commit | 3f7b163cb754f07ffbf8279a9b8e9f3c8daf526c (patch) | |
| tree | c9778095ea7e277df6b34444a9638ff7e532d72b | |
| parent | 3a495d5492def362b21378565aef91f15c9325a6 (diff) | |
| download | enigma2-3f7b163cb754f07ffbf8279a9b8e9f3c8daf526c.tar.gz enigma2-3f7b163cb754f07ffbf8279a9b8e9f3c8daf526c.zip | |
fix memleak check
cleanup
| -rw-r--r-- | lib/base/eerror.h | 50 | ||||
| -rw-r--r-- | lib/base/object.h | 9 |
2 files changed, 30 insertions, 29 deletions
diff --git a/lib/base/eerror.h b/lib/base/eerror.h index 4289ab30..e7c33a0b 100644 --- a/lib/base/eerror.h +++ b/lib/base/eerror.h @@ -17,33 +17,6 @@ #include <string> #include <new> #include <cxxabi.h> -#endif // MEMLEAK_CHECK - -#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); } - -#ifdef MEMLEAK_CHECK typedef struct { unsigned int address; @@ -127,6 +100,29 @@ void DumpUnfreed(); #endif // MEMLEAK_CHECK +#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, ...) { diff --git a/lib/base/object.h b/lib/base/object.h index d0e2a65e..7f823223 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -31,9 +31,13 @@ public: volatile int count; oRefCount(): count(0) { } operator volatile int&() { return count; } - ~oRefCount() { + ~oRefCount() + { #ifdef OBJECT_DEBUG - if (count) eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, count); else eDebug("OBJECT_DEBUG refcount ok! (%p)", this); + if (count) + eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, count); + else + eDebug("OBJECT_DEBUG refcount ok! (%p)", this); #endif } }; @@ -139,6 +143,7 @@ public: delete this; \ } #else + #warning use non optimized implementation of refcounting. #define DECLARE_REF(x) \ private:oRefCount ref; \ eSingleLock ref_lock; \ |
