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/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 +- 24 files changed, 390 insertions(+), 390 deletions(-) (limited to 'src/map') 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