From 539370ff1b37772e9f11439f652ffd3583beeedb Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 20 Apr 2007 02:13:48 +0000 Subject: More refactoring --- debug.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'debug.cc') diff --git a/debug.cc b/debug.cc index 3b996045..8457ce7d 100644 --- a/debug.cc +++ b/debug.cc @@ -25,54 +25,70 @@ std::map ptrs; void * operator new(std::size_t size) throw (std::bad_alloc) { void * ptr = std::malloc(size); +#if 0 // jww (2007-04-19): these don't work with boost::regex if (DEBUG("debug.alloc")) { PRINT_INC("void * operator new(std::size_t size) throw (std::bad_alloc)\n"); } +#endif return ptr; } void * operator new[](std::size_t size) throw (std::bad_alloc) { void * ptr = std::malloc(size); +#if 0 if (DEBUG("debug.alloc")) { PRINT_INC("void * operator new[](std::size_t) throw (std::bad_alloc)\n"); } +#endif return ptr; } void * operator new(std::size_t size, const std::nothrow_t&) throw() { void * ptr = std::malloc(size); +#if 0 if (DEBUG("debug.alloc")) { PRINT_INC("void * operator new(std::size_t size, const std::nothrow_t&) throw()\n"); } +#endif return ptr; } void * operator new[](std::size_t size, const std::nothrow_t&) throw() { void * ptr = std::malloc(size); +#if 0 if (DEBUG("debug.alloc")) { PRINT_INC("void * operator new[](std::size_t size, const std::nothrow_t&) throw()\n"); } +#endif return ptr; } void operator delete(void * ptr) throw() { +#if 0 if (DEBUG("debug.alloc")) { PRINT_DEC("void operator delete(void * ptr) throw()\n"); } +#endif std::free(ptr); } void operator delete[](void * ptr) throw() { +#if 0 if (DEBUG("debug.alloc")) { PRINT_DEC("void operator delete[](void * ptr) throw()\n"); } +#endif std::free(ptr); } void operator delete(void * ptr, const std::nothrow_t&) throw() { +#if 0 if (DEBUG("debug.alloc")) { PRINT_DEC("void operator delete(void * ptr, const std::nothrow_t&) throw()\n"); } +#endif std::free(ptr); } void operator delete[](void * ptr, const std::nothrow_t&) throw() { +#if 0 if (DEBUG("debug.alloc")) { PRINT_DEC("void operator delete[](void * ptr, const std::nothrow_t&) throw()\n"); } +#endif std::free(ptr); } @@ -81,8 +97,7 @@ bool _free_debug_stream = false; bool _debug_active(const char * const cls) { if (char * debug = std::getenv("DEBUG_CLASS")) { - static boost::regex class_regexp(debug); - return boost::regex_match(cls, class_regexp); + return boost::regex_match(cls, boost::regex(debug)); } return false; } -- cgit v1.2.3