summaryrefslogtreecommitdiff
path: root/src/common/malloc.h
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-19 03:05:16 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-19 03:05:16 +0000
commitaee3755b6d780c3261bdec2aef4d517bc7c7b148 (patch)
tree71dd1e301aab7780c23db9dd62de0ce7ce85a1d8 /src/common/malloc.h
parenta0a93b21ebfbf51e3926a6819b46632703c33d90 (diff)
downloadhercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.tar.gz
hercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.tar.bz2
hercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.tar.xz
hercules-aee3755b6d780c3261bdec2aef4d517bc7c7b148.zip
* Nullpo's disabled on release builds.
* Added timestamps to the log of memory leaks. * Moved definition of __func__ to cbasetypes.h. * Configure script updated: - added option to select the memory manager - added option to enable MAPREGSQL - added option to enable DEBUG * common's Makefile deleting svnversion.h on 'clean' target. (run ./configure again to update your Makefile) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11760 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/malloc.h')
-rw-r--r--src/common/malloc.h35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/common/malloc.h b/src/common/malloc.h
index 43eff40f1..1efc4686f 100644
--- a/src/common/malloc.h
+++ b/src/common/malloc.h
@@ -13,28 +13,28 @@
// and I have doubts our implementation works.
// -> They should NOT be used, period.
-#ifndef __NETBSD__
-#if __STDC_VERSION__ < 199901L
-# if __GNUC__ >= 2
-# define __func__ __FUNCTION__
-# else
-# define __func__ ""
-# endif
+#define ALC_MARK __FILE__, __LINE__, __func__
+
+// disable built-in memory manager when using another manager
+#if defined(MEMWATCH) || defined(DMALLOC) || defined(GCOLLECT) || defined(BCHECK)
+#if !defined(NO_MEMMGR)
+#define NO_MEMMGR
#endif
#endif
-#define ALC_MARK __FILE__, __LINE__, __func__
-//////////////////////////////////////////////////////////////////////
-// Whether to use Athena's built-in Memory Manager (enabled by default)
-// To disable just comment the following line
-#if !defined(DMALLOC) && !defined(BCHECK)
- #define USE_MEMMGR
+// Use built-in memory manager by default
+#if !defined(NO_MEMMGR) && !defined(USE_MEMMGR)
+#define USE_MEMMGR
#endif
-// Whether to enable Memory Manager's logging
-#define LOG_MEMMGR
+
+//////////////////////////////////////////////////////////////////////
+// Athena's built-in Memory Manager
#ifdef USE_MEMMGR
+// Enable memory manager logging by default
+#define LOG_MEMMGR
+
# define aMalloc(n) _mmalloc(n,ALC_MARK)
# define aMallocA(n) _mmalloc(n,ALC_MARK)
# define aCalloc(m,n) _mcalloc(m,n,ALC_MARK)
@@ -71,7 +71,7 @@
////////////// Memory Managers //////////////////
-#ifdef MEMWATCH
+#if defined(MEMWATCH)
# include "memwatch.h"
# define MALLOC(n,file,line,func) mwMalloc((n),(file),(line))
@@ -108,7 +108,6 @@
void * _bcallocA(size_t, size_t);
char * _bstrdup(const char *);
-/* FIXME Why is this the same as #else? [FlavioJS]
#elif defined(BCHECK)
# define MALLOC(n,file,line,func) malloc(n)
@@ -118,7 +117,7 @@
# define REALLOC(p,n,file,line,func) realloc((p),(n))
# define STRDUP(p,file,line,func) strdup(p)
# define FREE(p,file,line,func) free(p)
-*/
+
#else
# define MALLOC(n,file,line,func) malloc(n)