summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-07 14:52:15 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-07 14:52:15 +0000
commitbe2871f1e62bbb88c7fd413456d1b9c39d1f2fd9 (patch)
tree029ac5797e73b0e9af9976023a407485917ac92c
parenta37f1982ac7b798b1a696908d96059ed15d62065 (diff)
downloadhercules-be2871f1e62bbb88c7fd413456d1b9c39d1f2fd9.tar.gz
hercules-be2871f1e62bbb88c7fd413456d1b9c39d1f2fd9.tar.bz2
hercules-be2871f1e62bbb88c7fd413456d1b9c39d1f2fd9.tar.xz
hercules-be2871f1e62bbb88c7fd413456d1b9c39d1f2fd9.zip
some small USE_MEMMGR changes
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1428 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/common/malloc.c25
-rw-r--r--src/common/malloc.h9
2 files changed, 14 insertions, 20 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c
index b562ca3c0..b81c25ed5 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -8,7 +8,7 @@
#endif
// 独自メモリマネージャを使用する場合、次のコメントを外してください。
-// #define USE_MEMMGR
+//#define USE_MEMMGR
#if !defined(DMALLOC) && !defined(GCOLLECT) && !defined(BCHECK) && !defined(USE_MEMMGR)
@@ -314,14 +314,14 @@ void* aRealloc_(void *memblock, size_t size, const char *file, int line, const c
}
}
-void* aStrdup_(const void* string, const char *file, int line, const char *func ) {
- if(string == NULL) {
+char* aStrdup_(const void *p, const char *file, int line, const char *func ) {
+ if(p == NULL) {
return NULL;
} else {
- int len = strlen(string);
- char *p = (char *)aMalloc_(len + 1,file,line,func);
- memcpy(p,string,len+1);
- return p;
+ int len = strlen(p);
+ char *string = (char *)aMalloc_(len + 1,file,line,func);
+ memcpy(string,p,len+1);
+ return string;
}
}
@@ -536,12 +536,13 @@ static void memmer_exit(void) {
fclose(fp);
}
}
+#endif
int do_init_memmgr(const char* file) {
- sprintf(memmer_logfile,"%s.log",file);
- atexit(memmer_exit);
- printf("memmgr: initialised: %s\n",memmer_logfile);
+ #ifdef USE_MEMMGR
+ sprintf(memmer_logfile,"%s.log",file);
+ atexit(memmer_exit);
+ printf("memmgr: initialised: %s\n",memmer_logfile);
+ #endif
return 0;
}
-
-#endif
diff --git a/src/common/malloc.h b/src/common/malloc.h
index 1bc0eb292..c233adb8d 100644
--- a/src/common/malloc.h
+++ b/src/common/malloc.h
@@ -3,9 +3,6 @@
#include <stdlib.h>
-// 独自メモリマネージャを使用する場合、次のコメントを外してください。
-// #define USE_MEMMGR
-
#if defined(DMALLOC)
# include "dmalloc.h"
@@ -75,10 +72,6 @@
#endif
-#ifndef USE_MEMMGR
- #define do_init_memmgr(file)
-#else
- int do_init_memmgr(const char* file);
-#endif
+int do_init_memmgr(const char* file);
#endif