summaryrefslogtreecommitdiff
path: root/src/common/malloc.c
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.c
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.c')
-rw-r--r--src/common/malloc.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c
index 414770156..a65ee7eed 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -1,15 +1,18 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include "../common/malloc.h"
#include "../common/core.h"
#include "../common/showmsg.h"
-#ifdef MINICORE
- #undef LOG_MEMMGR
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+// no logging for minicore
+#if defined(MINICORE) && defined(LOG_MEMMGR)
+#undef LOG_MEMMGR
#endif
void* aMalloc_(size_t size, const char *file, int line, const char *func)
@@ -553,12 +556,17 @@ static FILE *log_fp;
static void memmgr_log (char *buf)
{
- if (!log_fp) {
+ time_t raw;
+ struct tm* t;
+ if( !log_fp )
+ {
log_fp = fopen(memmer_logfile,"w");
if (!log_fp) log_fp = stdout;
fprintf(log_fp, "Memory manager: Memory leaks found (Revision %s).\n", get_svn_revision());
}
- fprintf(log_fp, buf);
+ time(&raw);
+ t = localtime(&raw);
+ fprintf(log_fp, "%04d%02d%02d%02d%02d%02d %s", (t->tm_year+1900), (t->tm_mon+1), t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, buf);
return;
}
#endif