summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog.txt2
-rw-r--r--src/char_sql/char.c11
-rw-r--r--src/char_sql/int_guild.c15
-rw-r--r--src/common/grfio.c7
-rw-r--r--src/common/malloc.c6
-rw-r--r--src/common/malloc.h16
-rw-r--r--src/common/utils.c5
-rw-r--r--src/ladmin/Makefile2
-rw-r--r--src/login_sql/login.c7
-rw-r--r--src/map/battle.c10
-rw-r--r--src/map/intif.c3
-rw-r--r--src/map/itemdb.c2
-rw-r--r--src/map/map.c20
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/npc.c12
-rw-r--r--src/map/pc.c10
-rw-r--r--src/map/script.c8
-rw-r--r--src/map/skill.c10
-rw-r--r--src/map/storage.c5
19 files changed, 92 insertions, 61 deletions
diff --git a/Changelog.txt b/Changelog.txt
index adc35d9f0..397ad7ccc 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,5 +1,7 @@
Date Added
12/27
+ * switched malloc,calloc,realloc to aMalloc, aCalloc, aRealloc
+ so support the use of a garbage collector (SVN 821) [MouseJstr]
* Removed some printf's from map-sql [MC Cameri]
* Uncommented MSG_SQL, for _ShowMessage(), usage: ShowSQL() [MC Cameri]
* Removed fixed bugs in dev/bugs.txt [MC Cameri]
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 63e47a973..456fa0ac7 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -38,6 +38,7 @@
#include "itemdb.h"
#include "inter.h"
#include "db.h"
+#include "malloc.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -266,7 +267,7 @@ void read_gm_account(void) {
}
lsql_res = mysql_store_result(&lmysql_handle);
if (lsql_res) {
- gm_account = calloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
+ gm_account = aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
while ((lsql_row = mysql_fetch_row(lsql_res))) {
gm_account[GM_num].account_id = atoi(lsql_row[0]);
gm_account[GM_num].level = atoi(lsql_row[1]);
@@ -330,7 +331,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
cp = numdb_search(char_db_,char_id);
if (cp == NULL) {
- cp = (struct mmo_charstatus *) malloc(sizeof(struct mmo_charstatus));
+ cp = (struct mmo_charstatus *) aMalloc(sizeof(struct mmo_charstatus));
memset(cp, 0, sizeof(struct mmo_charstatus));
numdb_insert(char_db_, char_id,cp);
}
@@ -1130,7 +1131,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){
printf("char data load success]\n"); //ok. all data load successfuly!
- cp = (struct mmo_charstatus *) malloc(sizeof(struct mmo_charstatus));
+ cp = (struct mmo_charstatus *) aMalloc(sizeof(struct mmo_charstatus));
memcpy(cp, p, sizeof(struct mmo_charstatus));
numdb_insert(char_db_, char_id,cp);
@@ -2804,8 +2805,8 @@ int parse_char(int fd) {
int parse_console(char *buf) {
char *type,*command;
- type = (char *)malloc(64);
- command = (char *)malloc(64);
+ type = (char *)aMalloc(64);
+ command = (char *)aMalloc(64);
memset(type,0,64);
memset(command,0,64);
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index a30b9eb07..44ccdffbd 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -13,6 +13,7 @@
#include "mmo.h"
#include "socket.h"
#include "db.h"
+#include "malloc.h"
#include <string.h>
#include <stdio.h>
@@ -332,7 +333,7 @@ struct guild * inter_guild_fromsql(int guild_id)
if (g != NULL)
return g;
- g = (struct guild *) malloc(sizeof(struct guild));
+ g = (struct guild *) aMalloc(sizeof(struct guild));
memset(g,0,sizeof(struct guild));
// printf("Retrieve guild information from sql ......\n");
@@ -528,7 +529,7 @@ int inter_guildcastle_tosql(struct guild_castle *gc)
gcopy = numdb_search(castle_db_,gc->castle_id);
if (gcopy == NULL) {
- gcopy = (struct guild_castle *) malloc(sizeof(struct guild_castle));
+ gcopy = (struct guild_castle *) aMalloc(sizeof(struct guild_castle));
numdb_insert(castle_db_, gc->castle_id, gcopy);
} else {
if ((gc->guild_id == gcopy->guild_id ) && ( gc->economy == gcopy->economy ) && ( gc->defense == gcopy->defense ) && ( gc->triggerE == gcopy->triggerE ) && ( gc->triggerD == gcopy->triggerD ) && ( gc->nextTime == gcopy->nextTime ) && ( gc->payTime == gcopy->payTime ) && ( gc->createTime == gcopy->createTime ) && ( gc->visibleC == gcopy->visibleC ) && ( gc->visibleG0 == gcopy->visibleG0 ) && ( gc->visibleG1 == gcopy->visibleG1 ) && ( gc->visibleG2 == gcopy->visibleG2 ) && ( gc->visibleG3 == gcopy->visibleG3 ) && ( gc->visibleG4 == gcopy->visibleG4 ) && ( gc->visibleG5 == gcopy->visibleG5 ) && ( gc->visibleG6 == gcopy->visibleG6 ) && ( gc->visibleG7 == gcopy->visibleG7 ) && ( gc->Ghp0 == gcopy->Ghp0 ) && ( gc->Ghp1 == gcopy->Ghp1 ) && ( gc->Ghp2 == gcopy->Ghp2 ) && ( gc->Ghp3 == gcopy->Ghp3 ) && ( gc->Ghp4 == gcopy->Ghp4 ) && ( gc->Ghp5 == gcopy->Ghp5 ) && ( gc->Ghp6 == gcopy->Ghp6 ) && ( gc->Ghp7 == gcopy->Ghp7 ))
@@ -578,7 +579,7 @@ int inter_guildcastle_fromsql(int castle_id,struct guild_castle *gc)
gcopy = numdb_search(castle_db_,gc->castle_id);
if (gcopy == NULL) {
- gcopy = (struct guild_castle *) malloc(sizeof(struct guild_castle));
+ gcopy = (struct guild_castle *) aMalloc(sizeof(struct guild_castle));
numdb_insert(castle_db_, gc->castle_id, gcopy);
} else {
memcpy(gc, gcopy, sizeof(struct guild_castle));
@@ -678,9 +679,9 @@ int inter_guild_sql_init()
guild_castleinfoevent_db_=numdb_init();
printf("interserver guild memory initialize.... (%d byte)\n",sizeof(struct guild));
- guild_pt = calloc(sizeof(struct guild), 1);
- guild_pt2= calloc(sizeof(struct guild), 1);
- guildcastle_pt=calloc(sizeof(struct guild_castle), 1);
+ guild_pt = aCalloc(sizeof(struct guild), 1);
+ guild_pt2= aCalloc(sizeof(struct guild), 1);
+ guildcastle_pt=aCalloc(sizeof(struct guild_castle), 1);
inter_guild_readdb(); // Read exp
@@ -1096,7 +1097,7 @@ int mapif_guild_castle_alldataload(int fd) {
gcopy = numdb_search(castle_db_,gc->castle_id);
if (gcopy == NULL) {
- gcopy = (struct guild_castle *) malloc(sizeof(struct guild_castle));
+ gcopy = (struct guild_castle *) aMalloc(sizeof(struct guild_castle));
numdb_insert(castle_db_, gc->castle_id, gcopy);
}
memcpy(gcopy, gc, sizeof(struct guild_castle));
diff --git a/src/common/grfio.c b/src/common/grfio.c
index f9d99bd70..ea5bba6ab 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -31,6 +31,7 @@
#include "grfio.h"
#include "mmo.h"
#include "showmsg.h"
+#include "malloc.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -350,7 +351,7 @@ static FILELIST* filelist_add(FILELIST *entry)
}
if (filelist_entrys>=filelist_maxentry) {
- FILELIST *new_filelist = (FILELIST*)realloc(
+ FILELIST *new_filelist = (FILELIST*)aRealloc(
(void*)filelist, (filelist_maxentry+FILELIST_ADDS)*sizeof(FILELIST) );
if (new_filelist != NULL) {
filelist = new_filelist;
@@ -395,7 +396,7 @@ static void filelist_adjust(void)
{
if (filelist!=NULL) {
if (filelist_maxentry>filelist_entrys) {
- FILELIST *new_filelist = (FILELIST*)realloc(
+ FILELIST *new_filelist = (FILELIST*)aRealloc(
(void*)filelist,filelist_entrys*sizeof(FILELIST) );
if (new_filelist != NULL) {
filelist = new_filelist;
@@ -857,7 +858,7 @@ int grfio_add(char *fname)
// ShowStatus(tmp_output);
if (gentry_entrys>=gentry_maxentry) {
- char **new_gentry = (char**)realloc(
+ char **new_gentry = (char**)aRealloc(
(void*)gentry_table,(gentry_maxentry+GENTRY_ADDS)*sizeof(char*) );
if (new_gentry!=NULL) {
int lop;
diff --git a/src/common/malloc.c b/src/common/malloc.c
index eda9bc218..dd1be030f 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -42,3 +42,9 @@ void* aRealloc_( void *p, size_t size, const char *file, int line, const char *f
}
return ret;
}
+
+void * _bcalloc(size_t size, size_t cnt) {
+ void *ret = malloc(size * cnt);
+ memset(ret, 0, size * cnt);
+ return ret;
+}
diff --git a/src/common/malloc.h b/src/common/malloc.h
index 3733a5e55..7b09d7074 100644
--- a/src/common/malloc.h
+++ b/src/common/malloc.h
@@ -3,6 +3,21 @@
#include <stdlib.h>
+#if defined(GCOLLECT)
+
+#include "gc.h"
+#define aMalloc(n) GC_MALLOC(n)
+#define aCalloc(m,n) _bcalloc(m,n)
+#define aRealloc(p,n) GC_REALLOC(p,n)
+
+extern void * _bcalloc(size_t, size_t);
+
+#elif defined(BCHECK)
+#define aMalloc(n) malloc(n)
+#define aCalloc(m,n) calloc(m,n)
+#define aRealloc(p,n) realloc(p,n)
+#else
+
#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __func__ __FUNCTION__
@@ -21,5 +36,6 @@ void* aRealloc_( void *p, size_t size, const char *file, int line, const char *f
#define aCalloc(m,n) aCalloc_(m,n,ALC_MARK)
#define aRealloc(p,n) aRealloc_(p,n,ALC_MARK)
+#endif
#endif
diff --git a/src/common/utils.c b/src/common/utils.c
index ccc81c1c5..9a7722478 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
+#include "malloc.h"
void dump(unsigned char *buffer, int num)
{
@@ -142,7 +143,7 @@ int StringBuf_Printf(struct StringBuf *sbuf,const char *fmt,...)
/* Else try again with more space. */
sbuf->max_ *= 2; // twice the old size
off = sbuf->ptr_ - sbuf->buf_;
- sbuf->buf_ = (char *) realloc(sbuf->buf_, sbuf->max_ + 1);
+ sbuf->buf_ = (char *) aRealloc(sbuf->buf_, sbuf->max_ + 1);
sbuf->ptr_ = sbuf->buf_ + off;
}
}
@@ -156,7 +157,7 @@ int StringBuf_Append(struct StringBuf *buf1,const struct StringBuf *buf2)
if (size2 >= buf1_avail) {
int off = buf1->ptr_ - buf1->buf_;
buf1->max_ += size2;
- buf1->buf_ = (char *) realloc(buf1->buf_, buf1->max_ + 1);
+ buf1->buf_ = (char *) aRealloc(buf1->buf_, buf1->max_ + 1);
buf1->ptr_ = buf1->buf_ + off;
}
diff --git a/src/ladmin/Makefile b/src/ladmin/Makefile
index 1b5ed3d97..ebe67a349 100644
--- a/src/ladmin/Makefile
+++ b/src/ladmin/Makefile
@@ -6,7 +6,7 @@ COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.
COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/malloc.h ../common/showmsg.h ../common/strlib.h
ladmin: ladmin.o md5calc.o $(COMMON_OBJ)
- $(CC) -o ../../$@ ladmin.o md5calc.o $(COMMON_OBJ)
+ $(CC) -o ../../$@ ladmin.o md5calc.o $(COMMON_OBJ) $(LIB_S)
ladmin.o: ladmin.c ladmin.h md5calc.h $(COMMON_H)
md5calc.o: md5calc.c md5calc.h
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 687eb3b37..d7f91a20a 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -40,6 +40,7 @@ void Gettimeofday(struct timeval *timenow)
#include <signal.h>
#include <fcntl.h>
#include <string.h>
+#include "malloc.h"
//add include for DBMS(mysql)
#include <mysql.h>
@@ -160,7 +161,7 @@ struct dbt *online_db;
void add_online_user(int account_id) {
int *p;
- p = malloc(sizeof(int));
+ p = aMalloc(sizeof(int));
if (p == NULL) {
printf("add_online_user: memory allocation failure (malloc)!\n");
exit(0);
@@ -1462,8 +1463,8 @@ int parse_login(int fd) {
int parse_console(char *buf) {
char *type,*command;
- type = (char *)malloc(64);
- command = (char *)malloc(64);
+ type = (char *)aMalloc(64);
+ command = (char *)aMalloc(64);
memset(type,0,64);
memset(command,0,64);
diff --git a/src/map/battle.c b/src/map/battle.c
index f7ca80a93..765ce9443 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -5416,11 +5416,11 @@ void battle_set_defaults() {
battle_config.natural_heal_skill_interval=10000;
battle_config.natural_heal_weight_rate=50;
battle_config.item_name_override_grffile=1;
- battle_config.item_equip_override_grffile=1; // [Celest]
- battle_config.item_slots_override_grffile=1; // [Celest]
- battle_config.indoors_override_grffile=1; // [Celest]
- battle_config.skill_sp_override_grffile=1; // [Celest]
- battle_config.cardillust_read_grffile=1; // [Celest]
+ battle_config.item_equip_override_grffile=0; // [Celest]
+ battle_config.item_slots_override_grffile=0; // [Celest]
+ battle_config.indoors_override_grffile=0; // [Celest]
+ battle_config.skill_sp_override_grffile=0; // [Celest]
+ battle_config.cardillust_read_grffile=0; // [Celest]
battle_config.arrow_decrement=1;
battle_config.max_aspd = 199;
battle_config.max_hp = 32500;
diff --git a/src/map/intif.c b/src/map/intif.c
index 28f1b65a2..379589556 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -31,6 +31,7 @@
#include "guild.h"
#include "pet.h"
#include "nullpo.h"
+#include "malloc.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -691,7 +692,7 @@ int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 <packet_len>.w <wispname>.24B
struct map_session_data *pl_sd;
char Wisp_name[24];
char mbuf[255];
- char *message = ((RFIFOW(fd,2) - 30) >= sizeof(mbuf)) ? (char *) malloc((RFIFOW(fd,2) - 30)) : mbuf;
+ char *message = ((RFIFOW(fd,2) - 30) >= sizeof(mbuf)) ? (char *) aMalloc((RFIFOW(fd,2) - 30)) : mbuf;
min_gm_level = (int)RFIFOW(fd,28);
memcpy(Wisp_name, RFIFOP(fd,4), 24);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index cf6ab52d0..815034d8c 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -764,7 +764,7 @@ static int itemdb_read_sqldb(void)
// Insert a new row into the item database
- /*id = calloc(sizeof(struct item_data), 1);
+ /*id = aCalloc(sizeof(struct item_data), 1);
if (id == NULL)
{
diff --git a/src/map/map.c b/src/map/map.c
index d89bf424d..91f82110f 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1769,7 +1769,7 @@ static int map_readafm(int m,char *fn) {
map[m].m = m;
xs = map[m].xs = afm_size[0];
ys = map[m].ys = afm_size[1];
- map[m].gat = calloc(s = map[m].xs * map[m].ys, 1);
+ map[m].gat = aCalloc(s = map[m].xs * map[m].ys, 1);
if(map[m].gat==NULL){
printf("out of memory : map_readmap gat\n");
@@ -1792,14 +1792,14 @@ static int map_readafm(int m,char *fn) {
map[m].bxs=(xs+BLOCK_SIZE-1)/BLOCK_SIZE;
map[m].bys=(ys+BLOCK_SIZE-1)/BLOCK_SIZE;
size = map[m].bxs * map[m].bys * sizeof(struct block_list*);
- map[m].block = calloc(size, 1);
+ map[m].block = aCalloc(size, 1);
if(map[m].block == NULL){
printf("out of memory : map_readmap block\n");
exit(1);
}
- map[m].block_mob = calloc(size, 1);
+ map[m].block_mob = aCalloc(size, 1);
if (map[m].block_mob == NULL) {
printf("out of memory : map_readmap block_mob\n");
exit(1);
@@ -1807,14 +1807,14 @@ static int map_readafm(int m,char *fn) {
size = map[m].bxs*map[m].bys*sizeof(int);
- map[m].block_count = calloc(size, 1);
+ map[m].block_count = aCalloc(size, 1);
if(map[m].block_count==NULL){
printf("out of memory : map_readmap block\n");
exit(1);
}
memset(map[m].block_count,0,size);
- map[m].block_mob_count=calloc(size, 1);
+ map[m].block_mob_count=aCalloc(size, 1);
if(map[m].block_mob_count==NULL){
printf("out of memory : map_readmap block_mob\n");
exit(1);
@@ -2067,15 +2067,15 @@ int parse_console(char *buf) {
int m, n;
struct map_session_data *sd;
- sd = calloc(sizeof(*sd), 1);
+ sd = aCalloc(sizeof(*sd), 1);
sd->fd = 0;
strcpy( sd->status.name , "console");
- type = (char *)malloc(64);
- command = (char *)malloc(64);
- map = (char *)malloc(64);
- buf2 = (char *)malloc(72);
+ type = (char *)aMalloc(64);
+ command = (char *)aMalloc(64);
+ map = (char *)aMalloc(64);
+ buf2 = (char *)aMalloc(72);
memset(type,0,64);
memset(command,0,64);
diff --git a/src/map/mob.c b/src/map/mob.c
index 3c3fc76a5..f9b049254 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -286,7 +286,7 @@ int mob_spawn_guardian(struct map_session_data *sd,char *mapname,
for(count=0;count<amount;count++){
struct guild_castle *gc;
- md=calloc(sizeof(struct mob_data), 1);
+ md=aCalloc(sizeof(struct mob_data), 1);
if(md==NULL){
printf("mob_spawn_guardian: out of memory !\n");
exit(1);
diff --git a/src/map/npc.c b/src/map/npc.c
index 9068909ea..4f6fa42ad 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -245,8 +245,8 @@ int npc_event_export(void *key,void *data,va_list ap)
char *buf;
char *p=strchr(lname,':');
// エクスポートされる
- ev=calloc(sizeof(struct event_data), 1);
- buf=calloc(50, 1);
+ ev=aCalloc(sizeof(struct event_data), 1);
+ buf=aCalloc(50, 1);
if (ev==NULL || buf==NULL) {
printf("npc_event_export: out of memory !\n");
exit(1);
@@ -460,7 +460,7 @@ int npc_addeventtimer(struct npc_data *nd,int tick,const char *name)
if( nd->eventtimer[i]==-1 )
break;
if(i<MAX_EVENTTIMER){
- char *evname=malloc(24);
+ char *evname=aMalloc(24);
if(evname==NULL){
printf("npc_addeventtimer: out of memory !\n");exit(1);
}
@@ -546,8 +546,8 @@ int npc_timerevent_import(void *key,void *data,va_list ap)
// タイマーイベント
struct npc_timerevent_list *te=nd->u.scr.timer_event;
int j,i=nd->u.scr.timeramount;
- if(te==NULL) te=malloc(sizeof(struct npc_timerevent_list));
- else te=realloc( te, sizeof(struct npc_timerevent_list) * (i+1) );
+ if(te==NULL) te=aMalloc(sizeof(struct npc_timerevent_list));
+ else te=aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) );
if(te==NULL){
printf("npc_timerevent_import: out of memory !\n");
exit(1);
@@ -1777,7 +1777,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
}else{
// duplicate
-// nd->u.scr.label_list=malloc(sizeof(struct npc_label_list)*label_dupnum);
+// nd->u.scr.label_list=aMalloc(sizeof(struct npc_label_list)*label_dupnum);
// memcpy(nd->u.scr.label_list,label_dup,sizeof(struct npc_label_list)*label_dupnum);
nd->u.scr.label_list=label_dup; // ラベルデータ共有
diff --git a/src/map/pc.c b/src/map/pc.c
index ccf163f4e..f7837f838 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -126,7 +126,7 @@ int pc_set_gm_level(int account_id, int level) {
}
GM_num++;
- gm_account = realloc(gm_account, sizeof(struct gm_account) * GM_num);
+ gm_account = aRealloc(gm_account, sizeof(struct gm_account) * GM_num);
gm_account[GM_num - 1].account_id = account_id;
gm_account[GM_num - 1].level = level;
return 0;
@@ -6430,7 +6430,7 @@ int pc_setreg(struct map_session_data *sd,int reg,int val)
}
}
sd->reg_num++;
- sd->reg = realloc(sd->reg, sizeof(*(sd->reg)) * sd->reg_num);
+ sd->reg = aRealloc(sd->reg, sizeof(*(sd->reg)) * sd->reg_num);
if (sd->reg == NULL){
printf("out of memory : pc_setreg\n");
exit(1);
@@ -6481,7 +6481,7 @@ int pc_setregstr(struct map_session_data *sd,int reg,char *str)
return 0;
}
sd->regstr_num++;
- sd->regstr = realloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
+ sd->regstr = aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
if(sd->regstr==NULL){
printf("out of memory : pc_setreg\n");
exit(1);
@@ -7750,7 +7750,7 @@ int pc_read_gm_account(int fd)
free(gm_account);
GM_num = 0;
#ifdef TXT_ONLY
- gm_account = calloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
+ gm_account = aCalloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
for (i = 4; i < RFIFOW(fd,2); i = i + 5) {
gm_account[GM_num].account_id = RFIFOL(fd,i);
gm_account[GM_num].level = (int)RFIFOB(fd,i+4);
@@ -7764,7 +7764,7 @@ int pc_read_gm_account(int fd)
}
lsql_res = mysql_store_result(&lmysql_handle);
if (lsql_res) {
- gm_account = calloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
+ gm_account = aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
while ((lsql_row = mysql_fetch_row(lsql_res))) {
gm_account[GM_num].account_id = atoi(lsql_row[0]);
gm_account[GM_num].level = atoi(lsql_row[1]);
diff --git a/src/map/script.c b/src/map/script.c
index c226473b5..91245d19e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5465,14 +5465,14 @@ int buildin_strmobinfo(struct script_state *st)
if(num==1) {
char *buf;
- buf=calloc(24, 1);
+ buf=aCalloc(24, 1);
buf=mob_db[class].name;
push_str(st->stack,C_STR,buf);
return 0;
}
else if(num==2) {
char *buf;
- buf=calloc(24, 1);
+ buf=aCalloc(24, 1);
buf=mob_db[class].jname;
push_str(st->stack,C_STR,buf);
return 0;
@@ -6137,7 +6137,7 @@ int buildin_getsavepoint(struct script_state *st)
sd=script_rid2sd(st);
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
- mapname=calloc(24, 1);
+ mapname=aCalloc(24, 1);
x=sd->status.save_point.x;
y=sd->status.save_point.y;
@@ -6206,7 +6206,7 @@ int buildin_getmapxy(struct script_state *st){
//??????????? >>> Possible needly check function parameters on C_STR,C_INT,C_INT <<< ???????????//
type=conv_num(st,& (st->stack->stack_data[st->start+5]));
- mapname=calloc(24, 1);
+ mapname=aCalloc(24, 1);
switch (type){
case 0: //Get Character Position
diff --git a/src/map/skill.c b/src/map/skill.c
index 794059e82..1e1c373cb 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5598,7 +5598,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
group->range=range;
if(skillid==HT_TALKIEBOX ||
skillid==RG_GRAFFITI){
- group->valstr=calloc(80, 1);
+ group->valstr=aCalloc(80, 1);
if(group->valstr==NULL){
printf("skill_castend_map: out of memory !\n");
exit(1);
@@ -6547,7 +6547,7 @@ int skill_unit_onlimit(struct skill_unit *src,unsigned int tick)
src->bl.x,src->bl.y,1);
if(group == NULL)
return 0;
- group->valstr=calloc(24, 1);
+ group->valstr=aCalloc(24, 1);
if(group->valstr==NULL){
printf("skill_unit_onlimit: out of memory !\n");
exit(1);
@@ -11204,9 +11204,9 @@ int skill_unit_move_unit_group( struct skill_unit_group *group, int m,int dx,int
int i,j, *r_flag, *s_flag, *m_flag;
struct skill_unit *unit1;
struct skill_unit *unit2;
- r_flag = (int *) malloc(sizeof(int) * group->unit_count);
- s_flag = (int *) malloc(sizeof(int) * group->unit_count);
- m_flag = (int *) malloc(sizeof(int) * group->unit_count);
+ r_flag = (int *) aMalloc(sizeof(int) * group->unit_count);
+ s_flag = (int *) aMalloc(sizeof(int) * group->unit_count);
+ m_flag = (int *) aMalloc(sizeof(int) * group->unit_count);
memset(r_flag,0, sizeof(int) * group->unit_count);// ?承フラグ
memset(s_flag,0, sizeof(int) * group->unit_count);// ?承フラグ
memset(m_flag,0, sizeof(int) * group->unit_count);// ?承フラグ
diff --git a/src/map/storage.c b/src/map/storage.c
index bc97b1390..501a16709 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -11,6 +11,7 @@
#include "storage.h"
#include "guild.h"
#include "nullpo.h"
+#include "malloc.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -71,7 +72,7 @@ struct storage *account2storage(int account_id)
struct storage *stor;
stor=numdb_search(storage_db,account_id);
if(stor == NULL) {
- stor = calloc(sizeof(struct storage), 1);
+ stor = aCalloc(sizeof(struct storage), 1);
if(stor == NULL){
printf("storage: out of memory!\n");
exit(0);
@@ -363,7 +364,7 @@ struct guild_storage *guild2storage(int guild_id)
if(guild_search(guild_id) != NULL) {
gs=numdb_search(guild_storage_db,guild_id);
if(gs == NULL) {
- gs = calloc(sizeof(struct guild_storage), 1);
+ gs = aCalloc(sizeof(struct guild_storage), 1);
if(gs==NULL){
printf("storage: out of memory!\n");
exit(0);