summaryrefslogtreecommitdiff
path: root/debug.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-20 02:13:48 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:28 -0400
commit539370ff1b37772e9f11439f652ffd3583beeedb (patch)
tree69e8b0a0aee571d7335eae4c6693829745de1484 /debug.cc
parent0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c (diff)
downloadfork-ledger-539370ff1b37772e9f11439f652ffd3583beeedb.tar.gz
fork-ledger-539370ff1b37772e9f11439f652ffd3583beeedb.tar.bz2
fork-ledger-539370ff1b37772e9f11439f652ffd3583beeedb.zip
More refactoring
Diffstat (limited to 'debug.cc')
-rw-r--r--debug.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/debug.cc b/debug.cc
index 3b996045..8457ce7d 100644
--- a/debug.cc
+++ b/debug.cc
@@ -25,54 +25,70 @@ std::map<void *, int> 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;
}