From b795233e374987f4c427f59922f271810f937eef Mon Sep 17 00:00:00 2001 From: ultramage Date: Sun, 7 Jan 2007 16:49:03 +0000 Subject: Undid the memset->malloc_set replacement git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9626 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char_sql/itemdb.c | 2 +- src/common/graph.c | 2 +- src/common/grfio.c | 8 +- src/common/malloc.c | 57 +---------- src/common/malloc.h | 11 --- src/common/mapindex.c | 2 +- src/common/plugins.c | 2 +- src/common/socket.c | 4 +- src/common/strlib.c | 2 +- src/common/timer.c | 6 +- src/map/atcommand.c | 258 +++++++++++++++++++++++++------------------------- src/map/battle.c | 16 ++-- src/map/charcommand.c | 74 +++++++-------- src/map/chrif.c | 8 +- src/map/clif.c | 82 ++++++++-------- src/map/guild.c | 8 +- src/map/irc.c | 54 +++++------ src/map/itemdb.c | 14 +-- src/map/log.c | 2 +- src/map/map.c | 6 +- src/map/map.h | 2 +- src/map/mercenary.c | 6 +- src/map/mob.c | 42 ++++---- src/map/npc.c | 18 ++-- src/map/party.c | 12 +-- src/map/path.c | 2 +- src/map/pc.c | 40 ++++---- src/map/pet.c | 12 +-- src/map/script.c | 30 +++--- src/map/skill.c | 40 ++++---- src/map/status.c | 42 ++++---- src/map/storage.c | 4 +- src/map/trade.c | 6 +- src/map/unit.c | 2 +- 34 files changed, 407 insertions(+), 469 deletions(-) (limited to 'src') diff --git a/src/char_sql/itemdb.c b/src/char_sql/itemdb.c index 9f76eb21c..3943c082d 100644 --- a/src/char_sql/itemdb.c +++ b/src/char_sql/itemdb.c @@ -99,7 +99,7 @@ static int itemdb_readdb(void) lines++; if(line[0]=='/' && line[1]=='/') continue; - malloc_tsetdword(str,0,sizeof(str)); + memset(str,0,sizeof(str)); for(j=0,np=p=line;j<4 && p;j++){ str[j]=p; p=strchr(p,','); diff --git a/src/common/graph.c b/src/common/graph.c index e56783816..a13379a6b 100644 --- a/src/common/graph.c +++ b/src/common/graph.c @@ -71,7 +71,7 @@ void graph_pallet(struct graph* g, int index,unsigned long c) { if(g == NULL || c >= 256) return; if(g->pallet_count <= index) { - malloc_set(g->png_data + 0x29 + 3 * g->pallet_count,0,(index - g->pallet_count) * 3); + memset(g->png_data + 0x29 + 3 * g->pallet_count,0,(index - g->pallet_count) * 3); g->pallet_count = index + 1; } g->png_data[0x29 + index * 3 ] = (unsigned char)((c >> 16) & 0xFF); // R diff --git a/src/common/grfio.c b/src/common/grfio.c index a821ee269..ba3b55bb3 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -169,7 +169,7 @@ static void BitConvert(BYTE *Src,char *BitSwapTable) int lop,prm; BYTE tmp[8]; // *(DWORD*)tmp=*(DWORD*)(tmp+4)=0; - malloc_tsetdword(tmp,0,8); + memset(tmp,0,8); for(lop=0;lop!=64;lop++) { prm = BitSwapTable[lop]-1; if (Src[(prm >> 3) & 7] & BitMaskTable[prm & 7]) { @@ -299,7 +299,7 @@ int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen) { z_stream stream; int err; - malloc_tsetdword(&stream, 0, sizeof(stream)); + memset(&stream, 0, sizeof(stream)); stream.next_in = (Bytef*)source; stream.avail_in = (uInt)sourceLen; /* Check for source > 64K on 16-bit machine: */ @@ -479,7 +479,7 @@ static FILELIST* filelist_add(FILELIST *entry) if (filelist_entrys >= filelist_maxentry) { filelist = (FILELIST *)aRealloc(filelist, (filelist_maxentry + FILELIST_ADDS) * sizeof(FILELIST)); - malloc_tsetdword(filelist + filelist_maxentry, '\0', FILELIST_ADDS * sizeof(FILELIST)); + memset(filelist + filelist_maxentry, '\0', FILELIST_ADDS * sizeof(FILELIST)); filelist_maxentry += FILELIST_ADDS; } @@ -949,7 +949,7 @@ char *grfio_alloc_ptr(char *fname) if (gentry_entrys >= gentry_maxentry) { gentry_maxentry += GENTRY_ADDS; gentry_table = (char**)aRealloc(gentry_table, gentry_maxentry * sizeof(char*)); - malloc_tsetdword(gentry_table + (gentry_maxentry - GENTRY_ADDS), 0, sizeof(char*) * GENTRY_ADDS); + memset(gentry_table + (gentry_maxentry - GENTRY_ADDS), 0, sizeof(char*) * GENTRY_ADDS); } len = strlen( fname ); buf = (char*)aMallocA(len + 1); diff --git a/src/common/malloc.c b/src/common/malloc.c index d4dda5b4c..fe73057ad 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -88,15 +88,13 @@ void aFree_(void *p, const char *file, int line, const char *func) void* _bcallocA(size_t size, size_t cnt) { void *ret = MALLOCA(size * cnt); - if (ret) //malloc_set(ret, 0, size * cnt); - malloc_set(ret, 0, size*cnt); + if (ret) memset(ret, 0, size * cnt); return ret; } void* _bcalloc(size_t size, size_t cnt) { void *ret = MALLOC(size * cnt); - if (ret) //malloc_set(ret, 0, size * cnt); - malloc_set(ret, 0, size*cnt); + if (ret) memset(ret, 0, size * cnt); return ret; } char* _bstrdup(const char *chr) @@ -295,8 +293,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) { void* _mcalloc(size_t num, size_t size, const char *file, int line, const char *func ) { void *p = _mmalloc(num * size,file,line,func); - //malloc_set(p,0,num * size); - malloc_set(p,0,num*size); + memset(p,0,num * size); return p; } @@ -654,54 +651,6 @@ static void memmgr_init (void) } #endif -#if defined(MEMSET_TURBO) && defined(_WIN32) - void malloc_set(void *dest, int value, int count){ - _asm - { - mov eax, value - mov ecx, count - mov ebx, ecx - mov edi, dest - shr ecx, 2 - test ecx, ecx - jz ByteOp - shl ecx, 2 - sub ebx, ecx - shr ecx, 2 - rep stosd - test ebx, ebx - jz Done - ByteOp: - mov ecx, ebx - rep stosb - Done: - } - } - // Sets 32-bit aligned memory. - void malloc_tsetdword(void *dest, int value, int count){ - _asm - { - mov edi, dest - mov ecx, count - shr ecx, 2 - mov eax, value - rep stosd - } - } - - // Sets 16-bit aligned memory. - void malloc_tsetword(void *dest, short value, int count){ - _asm - { - mov edi, dest - mov ecx, count - shr ecx, 1 - mov ax, value - rep stosw - } - } -#endif - /*====================================== * Initialise *-------------------------------------- diff --git a/src/common/malloc.h b/src/common/malloc.h index 503eba75b..d6f6adb3c 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -10,8 +10,6 @@ // and I have doubts our implementation works. // -> They should NOT be used, period. -#define MEMSET_TURBO - #ifndef __NETBSD__ #if __STDC_VERSION__ < 199901L # if __GNUC__ >= 2 @@ -163,15 +161,6 @@ unsigned int malloc_usage (void); #define INLINE inline #endif #endif -#if defined(MEMSET_TURBO) && defined(_WIN32) - INLINE void malloc_set(void *, int, int); - INLINE void malloc_tsetdword(void *, int, int); - INLINE void malloc_tsetword(void *, short, int); -#else - #define malloc_set(x,y,z) memset(x,y,z) - #define malloc_tsetdword(x,y,z) memset(x,y,z) - #define malloc_tsetword(x,y,z) memset(x,y,z) -#endif void malloc_init (void); void malloc_final (void); diff --git a/src/common/mapindex.c b/src/common/mapindex.c index d0843017e..070326463 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -106,7 +106,7 @@ void mapindex_init(void) { int index; char map_name[1024]; - malloc_tsetdword (&indexes, 0, sizeof (indexes)); + memset (&indexes, 0, sizeof (indexes)); fp=fopen(mapindex_cfgfile,"r"); if(fp==NULL){ ShowFatalError("Unable to read mapindex config file %s!\n", mapindex_cfgfile); diff --git a/src/common/plugins.c b/src/common/plugins.c index 5951885a1..3dcddcb3d 100644 --- a/src/common/plugins.c +++ b/src/common/plugins.c @@ -133,7 +133,7 @@ int export_symbol (void *var, int offset) plugin_call_table = (void**)aRealloc(plugin_call_table, max_call_table*sizeof(void*)); // clear the new alloced block - malloc_tsetdword(plugin_call_table + call_table_size, 0, (max_call_table-call_table_size)*sizeof(void*)); + memset(plugin_call_table + call_table_size, 0, (max_call_table-call_table_size)*sizeof(void*)); } // the new table size is delimited by the new element at the end diff --git a/src/common/socket.c b/src/common/socket.c index a230158c8..04793094c 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -434,7 +434,7 @@ int start_console(void) { if (!session[0]) { // dummy socket already uses fd 0 CREATE(session[0], struct socket_data, 1); } - malloc_set(session[0],0,sizeof(*session[0])); + memset(session[0],0,sizeof(*session[0])); session[0]->func_recv = console_recieve; session[0]->func_console = default_console_parse; @@ -1233,7 +1233,7 @@ void socket_init(void) session[0]->max_rdata = 2*rfifo_size; session[0]->max_wdata = 2*wfifo_size; - malloc_set(func_parse_table, 0, sizeof(func_parse_table)); + memset(func_parse_table, 0, sizeof(func_parse_table)); func_parse_table[SESSION_RAW].check = default_func_check; func_parse_table[SESSION_RAW].func = default_func_parse; diff --git a/src/common/strlib.c b/src/common/strlib.c index 92601f9b1..60ea266db 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -123,7 +123,7 @@ char *trim(char *str, const char *delim) char *strp = strtok(str,delim); char buf[1024]; char *bufp = buf; - malloc_tsetdword(buf,0,sizeof buf); + memset(buf,0,sizeof buf); while(strp) { strcpy(bufp, strp); diff --git a/src/common/timer.c b/src/common/timer.c index 3b4fb1db4..c7be0ab8f 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -153,7 +153,7 @@ static void push_timer_heap(int tid) } else { timer_heap_max += 256; RECREATE(timer_heap, int, timer_heap_max); - malloc_tsetdword(timer_heap + (timer_heap_max - 256), 0, sizeof(int) * 256); + memset(timer_heap + (timer_heap_max - 256), 0, sizeof(int) * 256); } } @@ -223,7 +223,7 @@ static int acquire_timer(void) {// add more timers timer_data_max += 256; RECREATE(timer_data, struct TimerData, timer_data_max); - malloc_tsetdword(timer_data + (timer_data_max - 256), 0, sizeof(struct TimerData) * 256); + memset(timer_data + (timer_data_max - 256), 0, sizeof(struct TimerData) * 256); } } @@ -412,7 +412,7 @@ int do_timer(unsigned int tick) if (free_timer_list_pos >= free_timer_list_max) { free_timer_list_max += 256; RECREATE(free_timer_list,int,free_timer_list_max); - malloc_tsetdword(free_timer_list + (free_timer_list_max - 256), 0, 256 * sizeof(int)); + memset(free_timer_list + (free_timer_list_max - 256), 0, 256 * sizeof(int)); } free_timer_list[free_timer_list_pos++] = i; break; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index bfe70145e..b4ccf5b79 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -782,7 +782,7 @@ is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int AtCommandInfo info; AtCommandType type; - malloc_set(&info, 0, sizeof(info)); + memset(&info, 0, sizeof(info)); type = atcommand(sd, gmlvl, str, &info); if (type != AtCommand_None) { @@ -797,8 +797,8 @@ is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int return AtCommand_None; } - malloc_tsetdword(command, '\0', sizeof(command)); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(command, '\0', sizeof(command)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); while (*p && !isspace(*p)) p++; if (p - str >= sizeof(command)) // too long @@ -877,7 +877,7 @@ AtCommandType atcommand(struct map_session_data* sd, const int level, const char if (*p == atcommand_symbol) { // check first char, try to skip |00 (or something else) [Lance] char command[101]; int i = 0; - malloc_set(info, 0, sizeof(AtCommandInfo)); + memset(info, 0, sizeof(AtCommandInfo)); sscanf(p, "%100s", command); command[sizeof(command)-1] = '\0'; @@ -922,7 +922,7 @@ int msg_config_read(const char *cfgName) { } if ((--called) == 0) - malloc_tsetdword(msg_table, 0, sizeof(msg_table[0]) * MAX_MSG); + memset(msg_table, 0, sizeof(msg_table[0]) * MAX_MSG); while(fgets(line, sizeof(line)-1, fp)) { if (line[0] == '/' && line[1] == '/') continue; @@ -1034,7 +1034,7 @@ int atcommand_commands( int i_cur_cmd,gm_lvl = pc_isGM(sd), count = 0; - malloc_tsetdword(cz_line_buff,' ',MESSAGE_SIZE); + memset(cz_line_buff,' ',MESSAGE_SIZE); cz_line_buff[MESSAGE_SIZE] = 0; clif_displaymessage(fd, msg_txt(273)); @@ -1052,7 +1052,7 @@ int atcommand_commands( { clif_displaymessage(fd,(char*)cz_line_buff); lpcz_cur = cz_line_buff; - malloc_tsetdword(cz_line_buff,' ',MESSAGE_SIZE); + memset(cz_line_buff,' ',MESSAGE_SIZE); cz_line_buff[MESSAGE_SIZE] = 0; } @@ -1320,7 +1320,7 @@ int atcommand_rura( nullpo_retr(-1, sd); - malloc_tsetdword(map_name, '\0', sizeof(map_name)); + memset(map_name, '\0', sizeof(map_name)); if (!message || !*message || (sscanf(message, "%15s %d %d", map_name, &x, &y) < 3 && @@ -1376,7 +1376,7 @@ int atcommand_where( int GM_level, pl_GM_level; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_player_name, '\0', sizeof atcmd_player_name); + memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @where )."); @@ -1425,7 +1425,7 @@ int atcommand_jumpto( return -1; } - malloc_tsetdword(atcmd_player_name, '\0', sizeof atcmd_player_name); + memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if (sscanf(message, "%23[^\n]", atcmd_player_name) < 1) return -1; if(strncmp(sd->status.name,atcmd_player_name,NAME_LENGTH)==0) //Yourself mate? Tsk tsk tsk. @@ -1463,7 +1463,7 @@ int atcommand_jump( nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); sscanf(message, "%d %d", &x, &y); @@ -1498,9 +1498,9 @@ int atcommand_who3( nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(match_text, '\0', sizeof(match_text)); - malloc_tsetdword(player_name, '\0', sizeof(player_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(match_text, '\0', sizeof(match_text)); + memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); @@ -1573,9 +1573,9 @@ int atcommand_who2( nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(match_text, '\0', sizeof(match_text)); - malloc_tsetdword(player_name, '\0', sizeof(player_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(match_text, '\0', sizeof(match_text)); + memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); @@ -1645,10 +1645,10 @@ int atcommand_who( nullpo_retr(-1, sd); - malloc_tsetdword(temp0, '\0', sizeof(temp0)); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(match_text, '\0', sizeof(match_text)); - malloc_tsetdword(player_name, '\0', sizeof(player_name)); + memset(temp0, '\0', sizeof(temp0)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(match_text, '\0', sizeof(match_text)); + memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); @@ -1722,8 +1722,8 @@ int atcommand_whomap3( int map_id; char map_name[MAP_NAME_LENGTH]; - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(map_name, '\0', sizeof(map_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) map_id = sd->bl.m; @@ -1782,8 +1782,8 @@ int atcommand_whomap2( nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(map_name, '\0', sizeof(map_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) map_id = sd->bl.m; @@ -1846,10 +1846,10 @@ int atcommand_whomap( nullpo_retr(-1, sd); - malloc_tsetdword(temp0, '\0', sizeof(temp0)); - malloc_tsetdword(temp1, '\0', sizeof(temp1)); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(map_name, '\0', sizeof(map_name)); + memset(temp0, '\0', sizeof(temp0)); + memset(temp1, '\0', sizeof(temp1)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) map_id = sd->bl.m; @@ -1923,11 +1923,11 @@ int atcommand_whogm( nullpo_retr(-1, sd); - malloc_tsetdword(temp0, '\0', sizeof(temp0)); - malloc_tsetdword(temp1, '\0', sizeof(temp1)); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(match_text, '\0', sizeof(match_text)); - malloc_tsetdword(player_name, '\0', sizeof(player_name)); + memset(temp0, '\0', sizeof(temp0)); + memset(temp1, '\0', sizeof(temp1)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(match_text, '\0', sizeof(match_text)); + memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); @@ -1994,9 +1994,9 @@ int atcommand_whozeny( nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(match_text, '\0', sizeof(match_text)); - malloc_tsetdword(player_name, '\0', sizeof(player_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(match_text, '\0', sizeof(match_text)); + memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); @@ -2144,7 +2144,7 @@ int atcommand_speed( nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { sprintf(atcmd_output, "Please, enter a speed value (usage: @speed <%d-%d>).", MIN_WALK_SPEED, MAX_WALK_SPEED); @@ -2179,8 +2179,8 @@ int atcommand_charspeed( nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%d %23[^\n]", &speed, atcmd_player_name) < 2) { sprintf(atcmd_output, "Please, enter a speed and a player name (usage: @charspeed > ).", MIN_WALK_SPEED, MAX_WALK_SPEED); @@ -2474,7 +2474,7 @@ int atcommand_kill( struct map_session_data *pl_sd; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name)); + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @kill )."); @@ -2525,7 +2525,7 @@ int atcommand_kami( unsigned long color=0; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if(*(command + 5) != 'c' && *(command + 5) != 'C') { @@ -2626,7 +2626,7 @@ int atcommand_item( int get_count, i; nullpo_retr(-1, sd); - malloc_tsetdword(item_name, '\0', sizeof(item_name)); + memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || sscanf(message, "%99s %d", item_name, &number) < 1) { clif_displaymessage(fd, "Please, enter an item name/id (usage: @item [quantity])."); @@ -2652,7 +2652,7 @@ int atcommand_item( for (i = 0; i < number; i += get_count) { // if not pet egg if (!pet_create_egg(sd, item_id)) { - malloc_set(&item_tmp, 0, sizeof(item_tmp)); + memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; item_tmp.identify = 1; @@ -2687,7 +2687,7 @@ int atcommand_item2( int loop, get_count, i; nullpo_retr(-1, sd); - malloc_tsetdword(item_name, '\0', sizeof(item_name)); + memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9) { clif_displaymessage(fd, "Please, enter all informations (usage: @item2 "); @@ -2723,7 +2723,7 @@ int atcommand_item2( refine = attr = 0; } for (i = 0; i < loop; i++) { - malloc_set(&item_tmp, 0, sizeof(item_tmp)); + memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; item_tmp.identify = identify; item_tmp.refine = refine; @@ -2916,7 +2916,7 @@ int atcommand_help( FILE* fp; nullpo_retr(-1, sd); - malloc_tsetdword(buf, '\0', sizeof(buf)); + memset(buf, '\0', sizeof(buf)); if ((fp = fopen(help_txt, "r")) != NULL) { clif_displaymessage(fd, msg_txt(26)); /* Help commands: */ @@ -2957,7 +2957,7 @@ int atcommand_help2( FILE* fp; nullpo_retr(-1, sd); - malloc_tsetdword(buf, '\0', sizeof(buf)); + memset(buf, '\0', sizeof(buf)); if ((fp = fopen(help2_txt, "r")) != NULL) { clif_displaymessage(fd, msg_txt(26)); /* Help commands: */ @@ -2997,7 +2997,7 @@ int atcommand_gm( char password[100]; nullpo_retr(-1, sd); - malloc_tsetdword(password, '\0', sizeof(password)); + memset(password, '\0', sizeof(password)); if (!message || !*message || sscanf(message, "%99[^\n]", password) < 1) { clif_displaymessage(fd, "Please, enter a password (usage: @gm )."); @@ -3143,7 +3143,7 @@ int atcommand_model( int hair_style = 0, hair_color = 0, cloth_color = 0; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d %d %d", &hair_style, &hair_color, &cloth_color) < 1) { sprintf(atcmd_output, "Please, enter at least a value (usage: @model ).", @@ -3186,7 +3186,7 @@ int atcommand_dye(const int fd, struct map_session_data* sd, const char* command int cloth_color = 0; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &cloth_color) < 1) { sprintf(atcmd_output, "Please, enter a clothes color (usage: @dye/@ccolor ).", MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); @@ -3214,7 +3214,7 @@ int atcommand_hair_style(const int fd, struct map_session_data* sd, const char* int hair_style = 0; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &hair_style) < 1) { sprintf(atcmd_output, "Please, enter a hair style (usage: @hairstyle/@hstyle ).", MIN_HAIR_STYLE, MAX_HAIR_STYLE); @@ -3261,7 +3261,7 @@ int atcommand_hair_color(const int fd, struct map_session_data* sd, const char* int hair_color = 0; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &hair_color) < 1) { sprintf(atcmd_output, "Please, enter a hair color (usage: @haircolor/@hcolor ).", MIN_HAIR_COLOR, MAX_HAIR_COLOR); @@ -3335,8 +3335,8 @@ int atcommand_go( return 0; } - malloc_tsetdword(map_name, '\0', sizeof(map_name)); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(map_name, '\0', sizeof(map_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); // get the number town = atoi(message); @@ -3494,9 +3494,9 @@ int atcommand_monster( short mx, my; nullpo_retr(-1, sd); - malloc_tsetdword(name, '\0', sizeof(name)); - malloc_tsetdword(monster, '\0', sizeof(monster)); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(name, '\0', sizeof(name)); + memset(monster, '\0', sizeof(monster)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { clif_displaymessage(fd, msg_txt(80)); // Give a display name and monster name/id please. @@ -3753,7 +3753,7 @@ void atcommand_killmonster_sub( if (!sd) return; - malloc_tsetdword(map_name, '\0', sizeof(map_name)); + memset(map_name, '\0', sizeof(map_name)); if (!message || !*message || sscanf(message, "%15s", map_name) < 1) map_id = sd->bl.m; @@ -3811,7 +3811,7 @@ int atcommand_refine( int count; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) { clif_displaymessage(fd, "Please, enter a position and a amount (usage: @refine <+/- amount>)."); @@ -3884,8 +3884,8 @@ int atcommand_produce( struct item tmp_item; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(item_name, '\0', sizeof(item_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1) { clif_displaymessage(fd, "Please, enter at least an item name/id (usage: @produce <# of very's>)."); @@ -3906,7 +3906,7 @@ int atcommand_produce( attribute = ATTRIBUTE_NORMAL; if (star < MIN_STAR || star > MAX_STAR) star = 0; - malloc_set(&tmp_item, 0, sizeof tmp_item); + memset(&tmp_item, 0, sizeof tmp_item); tmp_item.nameid = item_id; tmp_item.amount = 1; tmp_item.identify = 1; @@ -3942,7 +3942,7 @@ void atcommand_memo_sub(struct map_session_data* sd) { if (!sd) return; - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); clif_displaymessage(sd->fd, "Your actual memo positions are (except respawn point):"); for (i = MIN_PORTAL_MEMO; i <= MAX_PORTAL_MEMO; i++) { @@ -3967,7 +3967,7 @@ int atcommand_memo( int position = 0; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &position) < 1) atcommand_memo_sub(sd); @@ -4010,7 +4010,7 @@ int atcommand_gat( int y; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); for (y = 2; y >= -2; y--) { sprintf(atcmd_output, "%s (x= %d, y= %d) %02X %02X %02X %02X %02X", @@ -4240,7 +4240,7 @@ int atcommand_param( status[4] = &sd->status.dex; status[5] = &sd->status.luk; - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustement>)."); @@ -4568,7 +4568,7 @@ atcommand_recall( return -1; } - malloc_tsetdword(atcmd_player_name, '\0', sizeof atcmd_player_name); + memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if(sscanf(message, "%23[^\n]", atcmd_player_name) < 1) return -1; if(strncmp(sd->status.name,atcmd_player_name,NAME_LENGTH)==0) @@ -4610,7 +4610,7 @@ int atcommand_revive( struct map_session_data *pl_sd; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name)); + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @revive )."); @@ -4643,7 +4643,7 @@ int atcommand_char_block( { nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name)); + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%99[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @charblock/@block )."); @@ -4689,8 +4689,8 @@ int atcommand_char_ban( int year, month, day, hour, minute, second, value; nullpo_retr(-1, sd); - malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output)); - malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name)); + memset(atcmd_output, '\0', sizeof(atcmd_output)); + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%s %99[^\n]", atcmd_output, atcmd_player_name) < 2) { clif_displaymessage(fd, "Please, enter ban time and a player name (usage: @charban/@ban/@banish/@charbanish