summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author balr0g <balrog032@gmail.com>2015-06-07 15:35:00 -0400
committer balr0g <balrog032@gmail.com>2015-06-07 15:35:00 -0400
commit49bbeae98e7176078c257076bd27b47fc47e317e (patch)
treef22d45f701bb92803b83888d89cf598b938723ad
parentf6c745640fe6c1a0d3e1b2116afc75027fe0a69d (diff)
Revert "Placed back old corealloc otherwise NO_MEM_TRACKING do not have any meaning (nw)"
(Requested by R.Belmont since this breaks build with GCC 5.1.) This reverts commit aae343fcedb49943bbcadeda9f3ad41172b6eecb.
-rw-r--r--src/lib/util/corealloc.c35
-rw-r--r--src/lib/util/corealloc.h28
2 files changed, 44 insertions, 19 deletions
diff --git a/src/lib/util/corealloc.c b/src/lib/util/corealloc.c
index c8fcf7e3aa5..40d7456546a 100644
--- a/src/lib/util/corealloc.c
+++ b/src/lib/util/corealloc.c
@@ -96,6 +96,41 @@ bool memory_entry::s_tracking = false;
memory_entry *memory_entry::s_hash[memory_entry::k_hash_prime] = { NULL };
memory_entry *memory_entry::s_freehead = NULL;
+//**************************************************************************
+// OPERATOR REPLACEMENTS
+//**************************************************************************
+
+#ifndef NO_MEM_TRACKING
+
+// standard new/delete operators (try to avoid using)
+void *operator new(std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, false, true, false); }
+void *operator new[](std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, true, true, false); }
+void operator delete(void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, false); }
+void operator delete[](void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, true); }
+
+void* operator new(std::size_t size,const std::nothrow_t&) throw() { return malloc_file_line(size, NULL, 0, false, false, false); }
+void* operator new[](std::size_t size, const std::nothrow_t&) throw() { return malloc_file_line(size, NULL, 0, true, false, false); }
+void operator delete(void* ptr, const std::nothrow_t&) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, false); }
+void operator delete[](void* ptr, const std::nothrow_t&) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, true); }
+
+#endif
+
+//**************************************************************************
+// OPERATOR OVERLOADS - DEFINITIONS
+//**************************************************************************
+
+// file/line new/delete operators
+void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, false); }
+void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, false); }
+void operator delete(void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
+void operator delete[](void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+
+// file/line new/delete operators with zeroing
+void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, true); }
+void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, true); }
+void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
+void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+
//**************************************************************************
diff --git a/src/lib/util/corealloc.h b/src/lib/util/corealloc.h
index 5b002557769..eb97e643686 100644
--- a/src/lib/util/corealloc.h
+++ b/src/lib/util/corealloc.h
@@ -51,33 +51,23 @@ void dump_unfreed_mem(UINT64 start = 0);
//**************************************************************************
-// INLINE FUNCTIONS
+// OPERATOR OVERLOADS - DECLARATIONS
//**************************************************************************
// zeromem_t is a dummy class used to tell new to zero memory after allocation
class zeromem_t { };
-#ifndef NO_MEM_TRACKING
-
-// standard new/delete operators (try to avoid using)
-ATTR_FORCE_INLINE inline void *operator new(std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, false, true, false); }
-ATTR_FORCE_INLINE inline void *operator new[](std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, true, true, false); }
-ATTR_FORCE_INLINE inline void operator delete(void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, false); }
-ATTR_FORCE_INLINE inline void operator delete[](void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, true); }
-
-#endif
-
// file/line new/delete operators
-ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, false); }
-ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, false); }
-ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc);
+void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc);
+void operator delete(void *ptr, const char *file, int line);
+void operator delete[](void *ptr, const char *file, int line);
// file/line new/delete operators with zeroing
-ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, true); }
-ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, true); }
-ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc);
+void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc);
+void operator delete(void *ptr, const char *file, int line, const zeromem_t &);
+void operator delete[](void *ptr, const char *file, int line, const zeromem_t &);