diff options
-rw-r--r-- | src/char/char.c | 2 | ||||
-rw-r--r-- | src/char/inter.c | 2 | ||||
-rw-r--r-- | src/common/grfio.c | 12 | ||||
-rw-r--r-- | src/common/malloc.h | 5 | ||||
-rw-r--r-- | src/common/strlib.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 18 | ||||
-rw-r--r-- | src/map/intif.c | 2 | ||||
-rw-r--r-- | src/map/npc.c | 8 | ||||
-rw-r--r-- | src/map/script.c | 26 | ||||
-rw-r--r-- | src/map/storage.c | 2 |
10 files changed, 37 insertions, 42 deletions
diff --git a/src/char/char.c b/src/char/char.c index c2490efed..a569f5ca1 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -742,7 +742,7 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit SqlStmt_BindColumn(stmt, 8+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL); // bit array indicating which inventory items have already been matched - flag = (bool*) aCallocA(max, sizeof(bool)); + flag = (bool*) aCalloc(max, sizeof(bool)); while( SQL_SUCCESS == SqlStmt_NextRow(stmt) ) { diff --git a/src/char/inter.c b/src/char/inter.c index 2137579be..75f6533fe 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -326,7 +326,7 @@ int inter_mapif_init(int fd) // broadcast sending int mapif_broadcast(unsigned char *mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) { - unsigned char *buf = (unsigned char*)aMallocA((len)*sizeof(unsigned char)); + unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char)); WBUFW(buf,0) = 0x3800; WBUFW(buf,2) = len; diff --git a/src/common/grfio.c b/src/common/grfio.c index 88642cfe5..cc0e1bb42 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -406,7 +406,7 @@ void* grfio_reads(const char* fname, int* size) fseek(in,0,SEEK_END); declen = ftell(in); fseek(in,0,SEEK_SET); - buf2 = (unsigned char *)aMallocA(declen+1); // +1 for resnametable zero-termination + buf2 = (unsigned char *)aMalloc(declen+1); // +1 for resnametable zero-termination fileReadCount = fread(buf2, 1, declen, in); fclose(in); @@ -430,13 +430,13 @@ void* grfio_reads(const char* fname, int* size) FILE* in = fopen(grfname, "rb"); if( in != NULL ) { - unsigned char *buf = (unsigned char *)aMallocA(entry->srclen_aligned); + unsigned char *buf = (unsigned char *)aMalloc(entry->srclen_aligned); size_t fileReadCount; fseek(in, entry->srcpos, 0); fileReadCount = fread(buf, 1, entry->srclen_aligned, in); fclose(in); - buf2 = (unsigned char *)aMallocA(entry->declen+1); // +1 for resnametable zero-termination + buf2 = (unsigned char *)aMalloc(entry->declen+1); // +1 for resnametable zero-termination if( entry->type & FILELIST_TYPE_FILE ) {// file uLongf len; @@ -538,7 +538,7 @@ static int grfio_entryread(const char* grfname, int gentry) {// ****** Grf version 01xx ****** size_t fileReadCount; list_size = grf_size - ftell(fp); - grf_filelist = (unsigned char *) aMallocA(list_size); + grf_filelist = (unsigned char *) aMalloc(list_size); fileReadCount = fread(grf_filelist,1,list_size,fp); fclose(fp); @@ -604,8 +604,8 @@ static int grfio_entryread(const char* grfname, int gentry) return 4; } - rBuf = (unsigned char *)aMallocA(rSize); // Get a Read Size - grf_filelist = (unsigned char *)aMallocA(eSize); // Get a Extend Size + rBuf = (unsigned char *)aMalloc(rSize); // Get a Read Size + grf_filelist = (unsigned char *)aMalloc(eSize); // Get a Extend Size fileReadCount = fread(rBuf,1,rSize,fp); fclose(fp); decode_zip(grf_filelist, &eSize, rBuf, rSize); // Decode function diff --git a/src/common/malloc.h b/src/common/malloc.h index 5f8191d92..6b4e8e5c4 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -61,11 +61,6 @@ #endif -// deprecated, do not use -#define aMallocA aMalloc -#define aCallocA aCalloc -#define CREATE_A CREATE - /////////////// Buffer Creation ///////////////// // Full credit for this goes to Shinomori [Ajarn] diff --git a/src/common/strlib.c b/src/common/strlib.c index 7f79a5ef0..dfacbf136 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -1051,7 +1051,7 @@ StringBuf* StringBuf_Malloc() void StringBuf_Init(StringBuf* self) { self->max_ = 1024; - self->ptr_ = self->buf_ = (char*)aMallocA(self->max_ + 1); + self->ptr_ = self->buf_ = (char*)aMalloc(self->max_ + 1); } /// Appends the result of printf to the StringBuf diff --git a/src/map/clif.c b/src/map/clif.c index 3f7ad28ee..2770b61cc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2286,8 +2286,8 @@ void clif_inventorylist(struct map_session_data *sd) const int se = 28; #endif - buf = (unsigned char*)aMallocA(MAX_INVENTORY * s + 4); - bufe = (unsigned char*)aMallocA(MAX_INVENTORY * se + 4); + buf = (unsigned char*)aMalloc(MAX_INVENTORY * s + 4); + bufe = (unsigned char*)aMalloc(MAX_INVENTORY * se + 4); for( i = 0, n = 0, ne = 0; i < MAX_INVENTORY; i++ ) { @@ -2426,8 +2426,8 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items const int cmd = 28; #endif - buf = (unsigned char*)aMallocA(items_length * s + 4); - bufe = (unsigned char*)aMallocA(items_length * cmd + 4); + buf = (unsigned char*)aMalloc(items_length * s + 4); + bufe = (unsigned char*)aMalloc(items_length * cmd + 4); for( i = 0, n = 0, ne = 0; i < items_length; i++ ) { @@ -2506,8 +2506,8 @@ void clif_cartlist(struct map_session_data *sd) const int cmd = 28; #endif - buf = (unsigned char*)aMallocA(MAX_CART * s + 4); - bufe = (unsigned char*)aMallocA(MAX_CART * cmd + 4); + buf = (unsigned char*)aMalloc(MAX_CART * s + 4); + bufe = (unsigned char*)aMalloc(MAX_CART * cmd + 4); for( i = 0, n = 0, ne = 0; i < MAX_CART; i++ ) { @@ -5317,7 +5317,7 @@ void clif_displaymessage(const int fd, const char* mes) void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, enum send_target target) { int lp = type ? 4 : 0; - unsigned char *buf = (unsigned char*)aMallocA((4 + lp + len)*sizeof(unsigned char)); + unsigned char *buf = (unsigned char*)aMalloc((4 + lp + len)*sizeof(unsigned char)); WBUFW(buf,0) = 0x9a; WBUFW(buf,2) = 4 + lp + len; @@ -5390,7 +5390,7 @@ void clif_MainChatMessage(const char* message) /// 01c3 <packet len>.W <fontColor>.L <fontType>.W <fontSize>.W <fontAlign>.W <fontY>.W <message>.?B void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) { - unsigned char *buf = (unsigned char*)aMallocA((16 + len)*sizeof(unsigned char)); + unsigned char *buf = (unsigned char*)aMalloc((16 + len)*sizeof(unsigned char)); WBUFW(buf,0) = 0x1c3; WBUFW(buf,2) = len + 16; @@ -14742,7 +14742,7 @@ void clif_bg_message(struct battleground_data *bg, int src_id, const char *name, if( (sd = bg_getavailablesd(bg)) == NULL ) return; - buf = (unsigned char*)aMallocA((len + NAME_LENGTH + 8)*sizeof(unsigned char)); + buf = (unsigned char*)aMalloc((len + NAME_LENGTH + 8)*sizeof(unsigned char)); WBUFW(buf,0) = 0x2dc; WBUFW(buf,2) = len + NAME_LENGTH + 8; diff --git a/src/map/intif.c b/src/map/intif.c index f074b032b..54d039347 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -884,7 +884,7 @@ int mapif_parse_WisToGM(int fd) char *message; mes_len = RFIFOW(fd,2) - 32; - message = (char *) (mes_len >= 255 ? (char *) aMallocA(mes_len) : mbuf); + message = (char *) (mes_len >= 255 ? (char *) aMalloc(mes_len) : mbuf); permission = RFIFOL(fd,28); safestrncpy(Wisp_name, (char*)RFIFOP(fd,4), NAME_LENGTH); diff --git a/src/map/npc.c b/src/map/npc.c index bfdc486cd..9a0eaa71f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -458,7 +458,7 @@ int npc_timerevent_import(char* lname, void* data, va_list ap) int j, i = nd->u.scr.timeramount; if( te == NULL ) - te = (struct npc_timerevent_list*)aMallocA( sizeof(struct npc_timerevent_list) ); + te = (struct npc_timerevent_list*)aMalloc( sizeof(struct npc_timerevent_list) ); else te = (struct npc_timerevent_list*)aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) ); @@ -2180,7 +2180,7 @@ int npc_convertlabel_db(DBKey key, void* data, va_list ap) if( *label_list == NULL ) { - *label_list = (struct npc_label_list *) aCallocA (1, sizeof(struct npc_label_list)); + *label_list = (struct npc_label_list *) aCalloc (1, sizeof(struct npc_label_list)); *label_list_num = 0; } else *label_list = (struct npc_label_list *) aRealloc (*label_list, sizeof(struct npc_label_list)*(*label_list_num+1)); @@ -2391,7 +2391,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons struct npc_timerevent_list *te = nd->u.scr.timer_event; int j, k = nd->u.scr.timeramount; if (te == NULL) - te = (struct npc_timerevent_list *)aMallocA(sizeof(struct npc_timerevent_list)); + te = (struct npc_timerevent_list *)aMalloc(sizeof(struct npc_timerevent_list)); else te = (struct npc_timerevent_list *)aRealloc( te, sizeof(struct npc_timerevent_list) * (k+1) ); for (j = 0; j < k; j++){ @@ -2579,7 +2579,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch struct npc_timerevent_list *te = nd->u.scr.timer_event; int j, k = nd->u.scr.timeramount; if (te == NULL) - te = (struct npc_timerevent_list *)aMallocA(sizeof(struct npc_timerevent_list)); + te = (struct npc_timerevent_list *)aMalloc(sizeof(struct npc_timerevent_list)); else te = (struct npc_timerevent_list *)aRealloc( te, sizeof(struct npc_timerevent_list) * (k+1) ); for (j = 0; j < k; j++){ diff --git a/src/map/script.c b/src/map/script.c index f26d60b12..14c3ae6d9 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2935,7 +2935,7 @@ void op_2str(struct script_state* st, int op, const char* s1, const char* s2) case C_LE: a = (strcmp(s1,s2) <= 0); break; case C_ADD: { - char* buf = (char *)aMallocA((strlen(s1)+strlen(s2)+1)*sizeof(char)); + char* buf = (char *)aMalloc((strlen(s1)+strlen(s2)+1)*sizeof(char)); strcpy(buf, s1); strcat(buf, s2); script_pushstr(st, buf); @@ -7709,7 +7709,7 @@ BUILDIN_FUNC(gettimestr) fmtstr=script_getstr(st,2); maxlen=script_getnum(st,3); - tmpstr=(char *)aMallocA((maxlen+1)*sizeof(char)); + tmpstr=(char *)aMalloc((maxlen+1)*sizeof(char)); strftime(tmpstr,maxlen,fmtstr,localtime(&now)); tmpstr[maxlen]='\0'; @@ -10830,7 +10830,7 @@ BUILDIN_FUNC(getitemname) script_pushconststr(st,"null"); return 0; } - item_name=(char *)aMallocA(ITEM_NAME_LENGTH*sizeof(char)); + item_name=(char *)aMalloc(ITEM_NAME_LENGTH*sizeof(char)); memcpy(item_name, i_data->jname, ITEM_NAME_LENGTH); script_pushstr(st,item_name); @@ -12563,7 +12563,7 @@ BUILDIN_FUNC(charat) int pos = script_getnum(st,3); char *output; - output = (char*)aMallocA(2*sizeof(char)); + output = (char*)aMalloc(2*sizeof(char)); output[0] = '\0'; if(str && pos >= 0 && (unsigned int)pos < strlen(str)) @@ -12606,7 +12606,7 @@ BUILDIN_FUNC(insertchar) else if(index > len) index = len; - output = (char*)aMallocA(len + 2); + output = (char*)aMalloc(len + 2); memcpy(output, str, index); output[index] = c[0]; @@ -12634,7 +12634,7 @@ BUILDIN_FUNC(delchar) return 0; } - output = (char*)aMallocA(len); + output = (char*)aMalloc(len); memcpy(output, str, index); memcpy(&output[index], &str[index+1], len - index); @@ -12693,10 +12693,10 @@ BUILDIN_FUNC(substr) if(start >= 0 && end < strlen(str) && start <= end) { len = end - start + 1; - output = (char*)aMallocA(len + 1); + output = (char*)aMalloc(len + 1); memcpy(output, &str[start], len); } else - output = (char*)aMallocA(1); + output = (char*)aMalloc(1); output[len] = '\0'; @@ -12724,7 +12724,7 @@ BUILDIN_FUNC(explode) TBL_PC* sd = NULL; - temp = (char*)aMallocA(len + 1); + temp = (char*)aMalloc(len + 1); if( !data_isreference(data) ) { @@ -12835,7 +12835,7 @@ BUILDIN_FUNC(implode) if(array_size == -1) //empty array check (AmsTaff) { ShowWarning("script:implode: array length = 0\n"); - output = (char*)aMallocA(sizeof(char)*5); + output = (char*)aMalloc(sizeof(char)*5); sprintf(output,"%s","NULL"); } else { for(i = 0; i <= array_size; ++i) { @@ -12850,7 +12850,7 @@ BUILDIN_FUNC(implode) glue_len = strlen(glue); len += glue_len * (array_size); } - output = (char*)aMallocA(len + 1); + output = (char*)aMalloc(len + 1); //build output for(i = 0; i < array_size; ++i) { @@ -13426,7 +13426,7 @@ BUILDIN_FUNC(md5) char *md5str; tmpstr = script_getstr(st,2); - md5str = (char *)aMallocA((32+1)*sizeof(char)); + md5str = (char *)aMalloc((32+1)*sizeof(char)); MD5_String(tmpstr, md5str); script_pushstr(st, md5str); return 0; @@ -13590,7 +13590,7 @@ BUILDIN_FUNC(escape_sql) str = script_getstr(st,2); len = strlen(str); - esc_str = (char*)aMallocA(len*2+1); + esc_str = (char*)aMalloc(len*2+1); Sql_EscapeStringLen(mmysql_handle, esc_str, str, len); script_pushstr(st, esc_str); return 0; diff --git a/src/map/storage.c b/src/map/storage.c index 4f6dfff0e..eed454c7c 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -322,7 +322,7 @@ void storage_storage_quit(struct map_session_data* sd, int flag) static void* create_guildstorage(DBKey key, va_list args) { struct guild_storage *gs = NULL; - gs = (struct guild_storage *) aCallocA(sizeof(struct guild_storage), 1); + gs = (struct guild_storage *) aCalloc(sizeof(struct guild_storage), 1); gs->guild_id=key.i; return gs; } |