summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c258
-rw-r--r--src/map/battle.c16
-rw-r--r--src/map/charcommand.c74
-rw-r--r--src/map/chrif.c8
-rw-r--r--src/map/clif.c82
-rw-r--r--src/map/guild.c8
-rw-r--r--src/map/irc.c54
-rw-r--r--src/map/itemdb.c14
-rw-r--r--src/map/log.c2
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/mercenary.c6
-rw-r--r--src/map/mob.c42
-rw-r--r--src/map/npc.c18
-rw-r--r--src/map/party.c12
-rw-r--r--src/map/path.c2
-rw-r--r--src/map/pc.c40
-rw-r--r--src/map/pet.c12
-rw-r--r--src/map/script.c30
-rw-r--r--src/map/skill.c40
-rw-r--r--src/map/status.c42
-rw-r--r--src/map/storage.c4
-rw-r--r--src/map/trade.c6
-rw-r--r--src/map/unit.c2
24 files changed, 390 insertions, 390 deletions
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 <char name>).");
@@ -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 <speed <%d-%d>> <char name>).", 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 <char name>).");
@@ -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 <item name or ID> [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 <item name or ID> <quantity>");
@@ -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 <password>).");
@@ -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 <hair ID: %d-%d> <hair color: %d-%d> <clothes color: %d-%d>).",
@@ -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 <clothes color: %d-%d>).", 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 <hair ID: %d-%d>).", 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 <hair color: %d-%d>).", 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 <equip position> <+/- 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 <equip name or equip ID> <element> <# 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 <char name>).");
@@ -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 <name>).");
@@ -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 <time> <name>).");
@@ -4763,7 +4763,7 @@ int atcommand_char_unblock(
{
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: @charunblock <player_name>).");
@@ -4796,7 +4796,7 @@ int atcommand_char_unban(
{
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: @charunban <player_name>).");
@@ -4983,7 +4983,7 @@ int atcommand_kick(
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: @kick <charname>).");
@@ -5176,7 +5176,7 @@ int atcommand_party(
char party[NAME_LENGTH];
nullpo_retr(-1, sd);
- malloc_tsetdword(party, '\0', sizeof(party));
+ memset(party, '\0', sizeof(party));
if (!message || !*message || sscanf(message, "%23[^\n]", party) < 1) {
clif_displaymessage(fd, "Please, enter a party name (usage: @party <party_name>).");
@@ -5200,7 +5200,7 @@ int atcommand_guild(
int prev;
nullpo_retr(-1, sd);
- malloc_tsetdword(guild, '\0', sizeof(guild));
+ memset(guild, '\0', sizeof(guild));
if (!message || !*message || sscanf(message, "%23[^\n]", guild) < 1) {
clif_displaymessage(fd, "Please, enter a guild name (usage: @guild <guild_name>).");
@@ -5296,8 +5296,8 @@ int atcommand_idsearch(
struct item_data *item_array[MAX_SEARCH];
nullpo_retr(-1, sd);
- malloc_tsetdword(item_name, '\0', sizeof(item_name));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(item_name, '\0', sizeof(item_name));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message || sscanf(message, "%99s", item_name) < 0) {
clif_displaymessage(fd, "Please, enter a part of item name (usage: @idsearch <part_of_item_name>).");
@@ -5335,7 +5335,7 @@ int atcommand_recallall(
int count, users;
nullpo_retr(-1, sd);
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
clif_displaymessage(fd, "You are not authorised to warp somenone to your actual map.");
@@ -5382,8 +5382,8 @@ int atcommand_guildrecall(
struct guild *g;
nullpo_retr(-1, sd);
- malloc_tsetdword(guild_name, '\0', sizeof(guild_name));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(guild_name, '\0', sizeof(guild_name));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) {
clif_displaymessage(fd, "Please, enter a guild name/id (usage: @guildrecall <guild_name/id>).");
@@ -5439,8 +5439,8 @@ int atcommand_partyrecall(
int count, users;
nullpo_retr(-1, sd);
- malloc_tsetdword(party_name, '\0', sizeof(party_name));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(party_name, '\0', sizeof(party_name));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) {
clif_displaymessage(fd, "Please, enter a party name/id (usage: @partyrecall <party_name/id>).");
@@ -5708,9 +5708,9 @@ int atcommand_mapinfo(
unsigned short m_index;
nullpo_retr(-1, sd);
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
- malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name));
- malloc_tsetdword(direction, '\0', sizeof(direction));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
+ memset(direction, '\0', sizeof(direction));
sscanf(message, "%d %23[^\n]", &list, atcmd_player_name);
@@ -5955,7 +5955,7 @@ int atcommand_char_mount_peco(
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: @charmountpeco <char_name>).");
@@ -5996,8 +5996,8 @@ int atcommand_guildspy(
struct guild *g;
nullpo_retr(-1, sd);
- malloc_tsetdword(guild_name, '\0', sizeof(guild_name));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(guild_name, '\0', sizeof(guild_name));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!enable_spy)
{
@@ -6040,8 +6040,8 @@ int atcommand_partyspy(
struct party_data *p;
nullpo_retr(-1, sd);
- malloc_tsetdword(party_name, '\0', sizeof(party_name));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(party_name, '\0', sizeof(party_name));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!enable_spy)
{
@@ -6113,7 +6113,7 @@ int atcommand_nuke(
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: @nuke <char name>).");
@@ -6149,7 +6149,7 @@ int atcommand_tonpc(const int fd, struct map_session_data* sd,
nullpo_retr(-1, sd);
- malloc_tsetdword(npcname, 0, sizeof(npcname));
+ memset(npcname, 0, sizeof(npcname));
if (!message || !*message || sscanf(message, "%23[^\n]", npcname) < 1) {
clif_displaymessage(fd, "Please, enter a NPC name (usage: @tonpc <NPC_name>).");
@@ -6179,7 +6179,7 @@ int atcommand_shownpc(const int fd, struct map_session_data* sd,
char NPCname[NAME_LENGTH];
nullpo_retr(-1, sd);
- malloc_tsetdword(NPCname, '\0', sizeof(NPCname));
+ memset(NPCname, '\0', sizeof(NPCname));
if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) {
clif_displaymessage(fd, "Please, enter a NPC name (usage: @enablenpc <NPC_name>).");
@@ -6207,7 +6207,7 @@ int atcommand_hidenpc(const int fd, struct map_session_data* sd,
char NPCname[NAME_LENGTH];
nullpo_retr(-1, sd);
- malloc_tsetdword(NPCname, '\0', sizeof(NPCname));
+ memset(NPCname, '\0', sizeof(NPCname));
if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) {
clif_displaymessage(fd, "Please, enter a NPC name (usage: @hidenpc <NPC_name>).");
@@ -6258,7 +6258,7 @@ int atcommand_unloadnpc(const int fd, struct map_session_data* sd,
char NPCname[NAME_LENGTH];
nullpo_retr(-1, sd);
- malloc_tsetdword(NPCname, '\0', sizeof(NPCname));
+ memset(NPCname, '\0', sizeof(NPCname));
if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) {
clif_displaymessage(fd, "Please, enter a NPC name (usage: @npcoff <NPC_name>).");
@@ -6286,8 +6286,8 @@ char * txt_time(unsigned int duration) {
char temp[256];
static char temp1[256];
- malloc_tsetdword(temp, '\0', sizeof(temp));
- malloc_tsetdword(temp1, '\0', sizeof(temp1));
+ memset(temp, '\0', sizeof(temp));
+ memset(temp1, '\0', sizeof(temp1));
days = duration / (60 * 60 * 24);
duration = duration - (60 * 60 * 24 * days);
@@ -6331,7 +6331,7 @@ int atcommand_servertime(const int fd, struct map_session_data* sd,
char temp[256];
nullpo_retr(-1, sd);
- malloc_tsetdword(temp, '\0', sizeof(temp));
+ memset(temp, '\0', sizeof(temp));
time(&time_server); // get time in seconds since 1/1/1970
datetime = localtime(&time_server); // convert seconds in structure
@@ -6407,9 +6407,9 @@ int atcommand_chardelitem(const int fd, struct map_session_data* sd,
struct item_data *item_data;
nullpo_retr(-1, sd);
- malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name));
- malloc_tsetdword(item_name, '\0', sizeof(item_name));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
+ memset(item_name, '\0', sizeof(item_name));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message || sscanf(message, "%s %d %99[^\n]", item_name, &number, atcmd_player_name) < 3 || number < 1) {
clif_displaymessage(fd, "Please, enter an item name/id, a quantity and a player name (usage: @chardelitem <item_name_or_ID> <quantity> <player>).");
@@ -6505,7 +6505,7 @@ int atcommand_jail(
unsigned short m_index;
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: @jail <char_name>).");
@@ -6565,7 +6565,7 @@ int atcommand_unjail(
unsigned short m_index;
int x=0, y=0;
- 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: @unjail/@discharge <char_name>).");
@@ -6918,7 +6918,7 @@ int atcommand_exp(
char output[200];
double nextb, nextj;
nullpo_retr(-1, sd);
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(output, '\0', sizeof(output));
nextb = pc_nextbaseexp(sd);
if (nextb)
@@ -6944,7 +6944,7 @@ int atcommand_broadcast(
{
nullpo_retr(-1, sd);
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a message (usage: @broadcast <message>).");
@@ -6967,7 +6967,7 @@ int atcommand_localbroadcast(
{
nullpo_retr(-1, sd);
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a message (usage: @localbroadcast <message>).");
@@ -6994,8 +6994,8 @@ int atcommand_chardisguise(
struct map_session_data* pl_sd;
nullpo_retr(-1, sd);
- malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name));
- malloc_tsetdword(mob_name, '\0', sizeof(mob_name));
+ memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
+ memset(mob_name, '\0', sizeof(mob_name));
if (!message || !*message || sscanf(message, "%s %23[^\n]", mob_name, atcmd_player_name) < 2) {
clif_displaymessage(fd, "Please, enter a Monster/NPC name/id and a player name (usage: @chardisguise <monster_name_or_monster_ID> <char name>).");
@@ -7048,7 +7048,7 @@ int atcommand_charundisguise(
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: @charundisguise <char name>).");
@@ -7087,8 +7087,8 @@ int atcommand_email(
char new_email[100];
nullpo_retr(-1, sd);
- malloc_tsetdword(actual_email, '\0', sizeof(actual_email));
- malloc_tsetdword(new_email, '\0', sizeof(new_email));
+ memset(actual_email, '\0', sizeof(actual_email));
+ memset(new_email, '\0', sizeof(new_email));
if (!message || !*message || sscanf(message, "%99s %99s", actual_email, new_email) < 2) {
clif_displaymessage(fd, "Please enter 2 emails (usage: @email <actual@email> <new@email>).");
@@ -7152,9 +7152,9 @@ atcommand_character_cart_list(
int i, j, count, counter, counter2;
nullpo_retr(-1, sd);
- malloc_tsetdword(atcmd_player_name, '\0', sizeof(atcmd_player_name));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
- malloc_tsetdword(outputtmp, '\0', sizeof(outputtmp));
+ memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(outputtmp, '\0', sizeof(outputtmp));
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: @charitemlist <char name>).");
@@ -7178,7 +7178,7 @@ atcommand_character_cart_list(
else
sprintf(atcmd_output, "%d %s (%s, id: %d)", pl_sd->status.cart[i].amount, item_data->name, item_data->jname, pl_sd->status.cart[i].nameid);
clif_displaymessage(fd, atcmd_output);
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
counter2 = 0;
for (j = 0; j < item_data->slot; j++) {
if (pl_sd->status.cart[i].card[j]) {
@@ -7338,7 +7338,7 @@ atcommand_npcmove(const int fd, struct map_session_data* sd,
if (!message || !*message)
return -1;
- malloc_tsetdword(atcmd_player_name, '\0', sizeof atcmd_player_name);
+ memset(atcmd_player_name, '\0', sizeof atcmd_player_name);
if (sscanf(message, "%d %d %23[^\n]", &x, &y, atcmd_player_name) < 3) {
clif_displaymessage(fd, "Usage: @npcmove <X> <Y> <npc_name>");
@@ -7727,7 +7727,7 @@ void getring (struct map_session_data *sd)
else
item_id = 2634;
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid=item_id;
item_tmp.identify=1;
item_tmp.card[0]=255;
@@ -8365,7 +8365,7 @@ atcommand_sound(
return -1;
}
- malloc_tsetdword(sound_file, '\0', sizeof(sound_file));
+ memset(sound_file, '\0', sizeof(sound_file));
if(sscanf(message, "%99[^\n]", sound_file) < 1)
return -1;
@@ -8989,7 +8989,7 @@ int atcommand_jumptoid(
int cid=0;
struct map_session_data *pl_sd;
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || (cid = atoi(message)) == 0) {
clif_displaymessage(fd, "Please, enter a player CID (usage: @jumptoid/@warptoid/@gotoid <char id>).");
@@ -9034,7 +9034,7 @@ int atcommand_jumptoid2(
int aid=0;
struct map_session_data *pl_sd;
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || (aid = atoi(message)) == 0) {
clif_displaymessage(fd, "Please, enter a player AID (usage: @jumptoid/@warptoid/@gotoid <account id>).");
@@ -9078,7 +9078,7 @@ int atcommand_recallid(
int cid=0;
struct map_session_data *pl_sd;
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || (cid = atoi(message)) == 0) {
clif_displaymessage(fd, "Please, enter a player CID (usage: @recallid <char id>).");
@@ -9129,7 +9129,7 @@ int atcommand_recallid2(
int aid=0;
struct map_session_data *pl_sd;
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || (aid = atoi(message)) == 0) {
clif_displaymessage(fd, "Please, enter a player AID (usage: @recallid2 <account id>).");
@@ -9567,8 +9567,8 @@ int atcommand_mobinfo(
int count;
int i, j, k;
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
- malloc_tsetdword(atcmd_output2, '\0', sizeof(atcmd_output2));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(atcmd_output2, '\0', sizeof(atcmd_output2));
if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a Monster/ID (usage: @mobinfo <monster_name_or_monster_ID>).");
@@ -10237,8 +10237,8 @@ int atcommand_me(
char tempmes[200];
nullpo_retr(-1, sd);
- malloc_tsetdword(tempmes, '\0', sizeof(tempmes));
- malloc_tsetdword(atcmd_output, '\0', sizeof(atcmd_output));
+ memset(tempmes, '\0', sizeof(tempmes));
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
if (sd->sc.count && //no "chatting" while muted.
(sd->sc.data[SC_BERSERK].timer!=-1 ||
@@ -10773,7 +10773,7 @@ int atcommand_request(
void do_init_atcommand() {
users_db = db_alloc(__FILE__,__LINE__,DB_UINT,DB_OPT_BASE,sizeof(int));
duel_count = 0;
- malloc_tsetdword(&duel_list[0], 0, sizeof(duel_list));
+ memset(&duel_list[0], 0, sizeof(duel_list));
add_timer_func_list(atshowmobs_timer, "atshowmobs_timer");
return;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 6c7a5b07b..9a9343d31 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -81,7 +81,7 @@ struct block_list* battle_gettargeted(struct block_list *target)
int c = 0;
nullpo_retr(NULL, target);
- malloc_tsetdword(bl_list, 0, sizeof(bl_list));
+ memset(bl_list, 0, sizeof(bl_list));
map_foreachinrange(battle_gettargeted_sub, target, AREA_SIZE, BL_CHAR, bl_list, &c, target->id);
if (c == 0 || c > 24)
return NULL;
@@ -826,8 +826,8 @@ static struct Damage battle_calc_weapon_attack(
unsigned cardfix : 1;
} flag;
- malloc_tsetdword(&wd,0,sizeof(wd));
- malloc_tsetdword(&flag,0,sizeof(flag));
+ memset(&wd,0,sizeof(wd));
+ memset(&flag,0,sizeof(flag));
if(src==NULL || target==NULL)
{
@@ -2157,8 +2157,8 @@ struct Damage battle_calc_magic_attack(
unsigned cardfix : 1;
} flag;
- malloc_tsetdword(&ad,0,sizeof(ad));
- malloc_tsetdword(&flag,0,sizeof(flag));
+ memset(&ad,0,sizeof(ad));
+ memset(&flag,0,sizeof(flag));
if(src==NULL || target==NULL)
{
@@ -2518,8 +2518,8 @@ struct Damage battle_calc_misc_attack(
unsigned cardfix : 1;
} flag;
- malloc_tsetdword(&md,0,sizeof(md));
- malloc_tsetdword(&flag,0,sizeof(flag));
+ memset(&md,0,sizeof(md));
+ memset(&flag,0,sizeof(flag));
if( src == NULL || target == NULL ){
nullpo_info(NLP_MARK);
@@ -2777,7 +2777,7 @@ struct Damage battle_calc_attack( int attack_type,
default:
if (battle_config.error_log)
ShowError("battle_calc_attack: unknown attack type! %d\n",attack_type);
- malloc_tsetdword(&d,0,sizeof(d));
+ memset(&d,0,sizeof(d));
break;
}
if (d.damage + d.damage2 < 1)
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 8c360d8f8..6f588090c 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -127,7 +127,7 @@ is_charcommand_sub(const int fd, struct map_session_data* sd, const char* str, i
CharCommandInfo info;
CharCommandType type;
- malloc_set(&info, 0, sizeof(info));
+ memset(&info, 0, sizeof(info));
type = charcommand(sd, gmlvl, str, &info);
if (type != CharCommand_None) {
@@ -143,8 +143,8 @@ is_charcommand_sub(const int fd, struct map_session_data* sd, const char* str, i
return AtCommand_None;
}
- malloc_tsetdword(command, '\0', sizeof(command));
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(command, '\0', sizeof(command));
+ memset(output, '\0', sizeof(output));
while (*p && !isspace(*p))
p++;
if (p - str >= sizeof(command)) // too long
@@ -219,7 +219,7 @@ CharCommandType charcommand(struct map_session_data* sd, const int level, const
if (*p == charcommand_symbol) { // check first char, try to skip |00 (or something else) [Lance]
char command[101];
int i = 0;
- malloc_set(info, 0, sizeof(CharCommandInfo));
+ memset(info, 0, sizeof(CharCommandInfo));
sscanf(p, "%100s", command);
command[sizeof(command)-1] = '\0';
@@ -318,7 +318,7 @@ int charcommand_jobchange(
struct map_session_data* pl_sd;
int job = 0, upper = -1;
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(character, '\0', sizeof(character));
if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a job and a player name (usage: #job/#jobchange <job ID> <char name>).");
@@ -375,7 +375,7 @@ int charcommand_petrename(
struct map_session_data *pl_sd;
struct pet_data *pd;
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #petrename <char name>).");
@@ -419,7 +419,7 @@ int charcommand_petfriendly(
struct map_session_data *pl_sd;
struct pet_data *pd;
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message,"%d %23s",&friendly,character) < 2) {
clif_displaymessage(fd, "Please, enter a valid value (usage: "
"#petfriendly <0-1000> <player>).");
@@ -470,9 +470,9 @@ int charcommand_stats(
struct map_session_data *pl_sd;
int i;
- malloc_tsetdword(character, '\0', sizeof(character));
- malloc_tsetdword(job_jobname, '\0', sizeof(job_jobname));
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(character, '\0', sizeof(character));
+ memset(job_jobname, '\0', sizeof(job_jobname));
+ memset(output, '\0', sizeof(output));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #stats <char name>).");
@@ -541,8 +541,8 @@ int charcommand_reset(
char output[200];
struct map_session_data *pl_sd;
- malloc_tsetdword(character, '\0', sizeof(character));
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(character, '\0', sizeof(character));
+ memset(output, '\0', sizeof(output));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #reset <charname>).");
@@ -579,7 +579,7 @@ int charcommand_option(
int opt1 = 0, opt2 = 0, opt3 = 0;
struct map_session_data* pl_sd;
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(character, '\0', sizeof(character));
if (!message || !*message ||
sscanf(message, "%d %d %d %23[^\n]", &opt1, &opt2, &opt3, character) < 4 ||
@@ -620,8 +620,8 @@ int charcommand_save(
int x = 0, y = 0;
int m;
- malloc_tsetdword(map_name, '\0', sizeof(map_name));
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(map_name, '\0', sizeof(map_name));
+ memset(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%15s %d %d %23[^\n]", map_name, &x, &y, character) < 4 || x < 0 || y < 0) {
clif_displaymessage(fd, "Please, enter a valid save point and a player name (usage: #save <map> <x> <y> <charname>).");
@@ -673,8 +673,8 @@ int charcommand_stats_all(const int fd, struct map_session_data* sd, const char*
int count, users;
struct map_session_data *pl_sd, **pl_allsd;
- malloc_tsetdword(output, '\0', sizeof(output));
- malloc_tsetdword(gmlevel, '\0', sizeof(gmlevel));
+ memset(output, '\0', sizeof(output));
+ memset(gmlevel, '\0', sizeof(gmlevel));
count = 0;
pl_allsd = map_getallusers(&users);
@@ -717,7 +717,7 @@ int charcommand_spiritball(const int fd, struct map_session_data* sd,const char*
char character[NAME_LENGTH];
int spirit = 0;
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(character, '\0', sizeof(character));
if(!message || !*message || sscanf(message, "%d %23[^\n]", &spirit, character) < 2 || spirit < 0 || spirit > 1000) {
clif_displaymessage(fd, "Usage: @spiritball <number: 0-1000>) <CHARACTER_NAME>.");
@@ -765,10 +765,10 @@ charcommand_itemlist(
struct item *i_item; //Current inventory item.
nullpo_retr(-1, sd);
- malloc_tsetdword(character, '\0', sizeof(character));
- malloc_tsetdword(output, '\0', sizeof(output));
- malloc_tsetdword(equipstr, '\0', sizeof(equipstr));
- malloc_tsetdword(outputtmp, '\0', sizeof(outputtmp));
+ memset(character, '\0', sizeof(character));
+ memset(output, '\0', sizeof(output));
+ memset(equipstr, '\0', sizeof(equipstr));
+ memset(outputtmp, '\0', sizeof(outputtmp));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist <char name>).");
@@ -821,13 +821,13 @@ charcommand_itemlist(
// remove final ', '
equipstr[strlen(equipstr) - 2] = '\0';
} else
- malloc_tsetdword(equipstr, '\0', sizeof(equipstr));
+ memset(equipstr, '\0', sizeof(equipstr));
if (i_item->refine)
sprintf(output, "%d %s %+d (%s %+d, id: %d) %s", i_item->amount, item_data->name, i_item->refine, item_data->jname, i_item->refine, i_item->nameid, equipstr);
else
sprintf(output, "%d %s (%s, id: %d) %s", i_item->amount, item_data->name, item_data->jname, i_item->nameid, equipstr);
clif_displaymessage(fd, output);
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(output, '\0', sizeof(output));
counter2 = 0;
if(i_item->card[0]==CARD0_PET) { //pet eggs
@@ -925,9 +925,9 @@ charcommand_storagelist(
char character[NAME_LENGTH], output[200], outputtmp[200];
nullpo_retr(-1, sd);
- malloc_tsetdword(character, '\0', sizeof(character));
- malloc_tsetdword(output, '\0', sizeof(output));
- malloc_tsetdword(outputtmp, '\0', sizeof(outputtmp));
+ memset(character, '\0', sizeof(character));
+ memset(output, '\0', sizeof(output));
+ memset(outputtmp, '\0', sizeof(outputtmp));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist <char name>).");
@@ -952,7 +952,7 @@ charcommand_storagelist(
else
sprintf(output, "%d %s (%s, id: %d)", stor->storage_[i].amount, item_data->name, item_data->jname, stor->storage_[i].nameid);
clif_displaymessage(fd, output);
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(output, '\0', sizeof(output));
counter2 = 0;
for (j = 0; j < item_data->slot; j++) {
if (stor->storage_[i].card[j]) {
@@ -1008,7 +1008,7 @@ charcommand_giveitem_sub(struct map_session_data *sd,struct item_data *item_data
get_count = 1;
}
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_data->nameid;
item_tmp.identify = 1;
@@ -1041,7 +1041,7 @@ int charcommand_item(
char tmp_cmdoutput[1024];
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 %23[^\n]", item_name, &number, character) < 3) {
clif_displaymessage(fd, "Please, enter an item name/id (usage: #item <item name or ID> <quantity> <char name>).");
@@ -1076,7 +1076,7 @@ int charcommand_item(
100, 0, 1, pet_db[pet_id].jname);
// if not pet egg
} else {
- malloc_set(&item_tmp, 0, sizeof(item_tmp));
+ memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = 1;
@@ -1135,8 +1135,8 @@ int charcommand_warp(
nullpo_retr(-1, sd);
- malloc_tsetdword(map_name, '\0', sizeof(map_name));
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(map_name, '\0', sizeof(map_name));
+ memset(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%15s %d %d %23[^\n]", map_name, &x, &y, character) < 4) {
clif_displaymessage(fd, "Usage: #warp/#rura/#rura+ <mapname> <x> <y> <char name>");
@@ -1193,7 +1193,7 @@ int charcommand_zeny(
int zeny = 0, new_zeny;
nullpo_retr(-1, sd);
- malloc_tsetdword(character, '\0', sizeof(character));
+ memset(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%d %23[^\n]", &zeny, character) < 2 || zeny == 0) {
clif_displaymessage(fd, "Please, enter a number and a player name (usage: #zeny <zeny> <name>).");
@@ -1779,8 +1779,8 @@ int charcommand_feelreset(
char output[200];
struct map_session_data *pl_sd;
- malloc_tsetdword(character, '\0', sizeof(character));
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(character, '\0', sizeof(character));
+ memset(output, '\0', sizeof(output));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #feelreset <charname>).");
@@ -1817,7 +1817,7 @@ int charcommand_help(
FILE* fp;
nullpo_retr(-1, sd);
- malloc_tsetdword(buf, '\0', sizeof(buf));
+ memset(buf, '\0', sizeof(buf));
if ((fp = fopen(charhelp_txt, "r")) != NULL) {
clif_displaymessage(fd, msg_table[26]); /* Help commands: */
diff --git a/src/map/chrif.c b/src/map/chrif.c
index cbce3b6c8..ec0ab6aa6 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1168,9 +1168,9 @@ int chrif_recvfamelist(int fd)
int total = 0, len = 8;
RFIFOHEAD(fd);
- malloc_tsetdword (smith_fame_list, 0, sizeof(smith_fame_list));
- malloc_tsetdword (chemist_fame_list, 0, sizeof(chemist_fame_list));
- malloc_tsetdword (taekwon_fame_list, 0, sizeof(taekwon_fame_list));
+ memset (smith_fame_list, 0, sizeof(smith_fame_list));
+ memset (chemist_fame_list, 0, sizeof(chemist_fame_list));
+ memset (taekwon_fame_list, 0, sizeof(taekwon_fame_list));
size = RFIFOW(fd, 6); //Blacksmith block size
for (num = 0; len < size && num < MAX_FAME_LIST; num++) {
@@ -1317,7 +1317,7 @@ int chrif_load_scdata(int fd)
}
fclose(fp);
} else {
- malloc_tsetdword(buf, 0, sizeof(buf)); //No data found, send empty packets?
+ memset(buf, 0, sizeof(buf)); //No data found, send empty packets?
WFIFOW(char_fd,8) = sizeof(buf) + 10;
memcpy(WFIFOP(char_fd,10), buf, sizeof(buf));
}
diff --git a/src/map/clif.c b/src/map/clif.c
index b3b66e76b..8aaab7dd9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -873,7 +873,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
lv = status_get_lv(bl);
if(pcdb_checkid(vd->class_)) {
#if PACKETVER > 6
- malloc_set(buf,0,packet_len(0x22a));
+ memset(buf,0,packet_len(0x22a));
WBUFW(buf,0)=0x22a;
WBUFL(buf,2)=bl->id;
@@ -908,7 +908,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
WBUFW(buf,56)=clif_setlevel(lv);
return packet_len(0x22a);
#elif PACKETVER > 3
- malloc_set(buf,0,packet_len(0x1d8));
+ memset(buf,0,packet_len(0x1d8));
WBUFW(buf,0)=0x1d8;
WBUFL(buf,2)=bl->id;
@@ -943,7 +943,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
WBUFW(buf,52)=clif_setlevel(lv);
return packet_len(0x1d8);
#else
- malloc_set(buf,0,packet_len(0x78));
+ memset(buf,0,packet_len(0x78));
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=bl->id;
@@ -978,7 +978,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
#endif
}
//Non-player sprites need just a few fields filled.
- malloc_set(buf,0,packet_len(0x78));
+ memset(buf,0,packet_len(0x78));
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=bl->id;
@@ -1026,7 +1026,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
if(pcdb_checkid(vd->class_)) {
#if PACKETVER > 6
- malloc_set(buf,0,packet_len(0x22c));
+ memset(buf,0,packet_len(0x22c));
WBUFW(buf,0)=0x22c;
WBUFL(buf,2)=bl->id;
@@ -1062,7 +1062,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
return packet_len(0x22c);
#elif PACKETVER > 3
- malloc_set(buf,0,packet_len(0x1da));
+ memset(buf,0,packet_len(0x1da));
WBUFW(buf,0)=0x1da;
WBUFL(buf,2)=bl->id;
@@ -1098,7 +1098,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
return packet_len(0x1da);
#else
- malloc_set(buf,0,packet_len(0x7b));
+ memset(buf,0,packet_len(0x7b));
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=bl->id;
@@ -1135,7 +1135,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
}
//Non-player sprites only require a few fields.
#if PACKETVER > 6
- malloc_set(buf,0,packet_len(0x22c));
+ memset(buf,0,packet_len(0x22c));
WBUFW(buf,0)=0x22c;
WBUFL(buf,2)=bl->id;
@@ -1159,7 +1159,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFW(buf,62)=clif_setlevel(lv);
return packet_len(0x22c);
#else
- malloc_set(buf,0,packet_len(0x7b));
+ memset(buf,0,packet_len(0x7b));
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=bl->id;
@@ -1369,7 +1369,7 @@ int clif_spawn(struct block_list *bl)
}
} else { //Mob spawn packet.
struct status_change *sc = status_get_sc(bl);
- malloc_tsetdword(buf,0,sizeof(buf));
+ memset(buf,0,sizeof(buf));
WBUFW(buf,0)=0x7c;
WBUFL(buf,2)=bl->id;
WBUFW(buf,6)=status_get_speed(bl);
@@ -1428,7 +1428,7 @@ int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
nullpo_retr(0, hd);
status = &hd->battle_status;
- malloc_set(buf,0,packet_len(0x22e));
+ memset(buf,0,packet_len(0x22e));
WBUFW(buf,0)=0x22e;
memcpy(WBUFP(buf,2),hd->homunculus.name,NAME_LENGTH);
// Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true)
@@ -1654,7 +1654,7 @@ int clif_movepc(struct map_session_data *sd) {
|| map[sd->bl.m].flag.rain
|| map[sd->bl.m].flag.clouds2
) {
- malloc_set(buf,0,packet_len(0x7b));
+ memset(buf,0,packet_len(0x7b));
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=-10;
WBUFW(buf,6)=sd->battle_status.speed;
@@ -2001,7 +2001,7 @@ void clif_sendfakenpc(struct map_session_data *sd, int npcid) {
int fd = sd->fd;
WFIFOHEAD(fd, packet_len(0x78));
sd->state.using_fake_npc = 1;
- malloc_set(WFIFOP(fd,0), 0, packet_len(0x78));
+ memset(WFIFOP(fd,0), 0, packet_len(0x78));
WFIFOW(fd,0)=0x78;
WFIFOL(fd,2)=npcid;
WFIFOW(fd,14)=111;
@@ -3186,7 +3186,7 @@ int clif_misceffect2(struct block_list *bl, int type) {
nullpo_retr(0, bl);
- malloc_set(buf, 0, packet_len(0x1f3));
+ memset(buf, 0, packet_len(0x1f3));
WBUFW(buf,0) = 0x1f3;
WBUFL(buf,2) = bl->id;
@@ -4063,7 +4063,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
WFIFOHEAD(fd,packet_len(0x1c9));
- malloc_set(WFIFOP(fd,0),0,packet_len(0x1c9));
+ memset(WFIFOP(fd,0),0,packet_len(0x1c9));
WFIFOW(fd, 0)=0x1c9;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4078,7 +4078,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
}
#endif
WFIFOHEAD(fd,packet_len(0x11f));
- malloc_set(WFIFOP(fd,0),0,packet_len(0x11f));
+ memset(WFIFOP(fd,0),0,packet_len(0x11f));
WFIFOW(fd, 0)=0x11f;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4097,7 +4097,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
return 0;
/* Previous implementation guess of packet 0x1c9, who can understand what all those fields are for? [Skotlex]
WFIFOHEAD(fd,packet_len(0x1c9));
- malloc_set(WFIFOP(fd,0),0,packet_len(0x1c9));
+ memset(WFIFOP(fd,0),0,packet_len(0x1c9));
WFIFOW(fd, 0)=0x1c9;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4730,7 +4730,7 @@ int clif_skill_setunit(struct skill_unit *unit)
#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
- malloc_set(WBUFP(buf, 0),0,packet_len(0x1c9));
+ memset(WBUFP(buf, 0),0,packet_len(0x1c9));
WBUFW(buf, 0)=0x1c9;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -4748,7 +4748,7 @@ int clif_skill_setunit(struct skill_unit *unit)
return 0;
}
#endif
- malloc_set(WBUFP(buf, 0),0,packet_len(0x11f));
+ memset(WBUFP(buf, 0),0,packet_len(0x11f));
WBUFW(buf, 0)=0x11f;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -4764,7 +4764,7 @@ int clif_skill_setunit(struct skill_unit *unit)
return 0;
/* Previous mysterious implementation noone really understands. [Skotlex]
- malloc_set(WBUFP(buf, 0),0,packet_len(0x1c9));
+ memset(WBUFP(buf, 0),0,packet_len(0x1c9));
WBUFW(buf, 0)=0x1c9;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -6361,7 +6361,7 @@ int clif_pet_emotion(struct pet_data *pd,int param)
nullpo_retr(0, pd);
- malloc_set(buf,0,packet_len(0x1aa));
+ memset(buf,0,packet_len(0x1aa));
WBUFW(buf,0)=0x1aa;
WBUFL(buf,2)=pd->bl.id;
@@ -6386,7 +6386,7 @@ int clif_pet_performance(struct block_list *bl,int param)
nullpo_retr(0, bl);
- malloc_set(buf,0,packet_len(0x1a4));
+ memset(buf,0,packet_len(0x1a4));
WBUFW(buf,0)=0x1a4;
WBUFB(buf,2)=4;
@@ -6404,7 +6404,7 @@ int clif_pet_equip(struct pet_data *pd)
nullpo_retr(0, pd);
- malloc_set(buf,0,packet_len(0x1a4));
+ memset(buf,0,packet_len(0x1a4));
WBUFW(buf,0)=0x1a4;
WBUFB(buf,2)=3;
@@ -6695,7 +6695,7 @@ int clif_guild_belonginfo(struct map_session_data *sd,struct guild *g)
ps=guild_getposition(sd,g);
WFIFOHEAD(fd,packet_len(0x16c));
- malloc_set(WFIFOP(fd,0),0,packet_len(0x16c));
+ memset(WFIFOP(fd,0),0,packet_len(0x16c));
WFIFOW(fd,0)=0x16c;
WFIFOL(fd,2)=g->guild_id;
WFIFOL(fd,6)=g->emblem_id;
@@ -6899,7 +6899,7 @@ int clif_guild_memberlist(struct map_session_data *sd)
WFIFOL(fd,c*104+22)=m->exp;
WFIFOL(fd,c*104+26)=m->online;
WFIFOL(fd,c*104+30)=m->position;
- malloc_tsetword(WFIFOP(fd,c*104+34),0,50); // メモ?
+ memset(WFIFOP(fd,c*104+34),0,50); // メモ?
memcpy(WFIFOP(fd,c*104+84),m->name,NAME_LENGTH);
c++;
}
@@ -7677,7 +7677,7 @@ void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *na
int clif_soundeffectall(struct block_list *bl, char *name, int type, int coverage)
{
unsigned char buf[40];
- malloc_set(buf, 0, packet_len(0x1d3));
+ memset(buf, 0, packet_len(0x1d3));
if(coverage < 0 || coverage > 22){
ShowError("clif_soundeffectall: undefined coverage.\n");
@@ -7703,7 +7703,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag)
nullpo_retr(0, bl);
- malloc_set(buf, 0, packet_len(0x1f3));
+ memset(buf, 0, packet_len(0x1f3));
WBUFW(buf,0) = 0x1f3;
WBUFL(buf,2) = bl->id;
@@ -8045,7 +8045,7 @@ void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int cl
else if (mobdb_checkid(class_))
strncpy(WFIFOP(fd,2),mob_db(class_)->jname, NAME_LENGTH);
else //Really shouldn't happen...
- malloc_tsetdword(WFIFOP(fd,2), 0, NAME_LENGTH);
+ memset(WFIFOP(fd,2), 0, NAME_LENGTH);
WFIFOL(fd,26)=sd->bl.id;
WFIFOB(fd,30)=hate_level;
WFIFOB(fd,31)=type?10:11; //Register/Info
@@ -8077,7 +8077,7 @@ void clif_feel_hate_reset(struct map_session_data *sd)
int fd=sd->fd;
WFIFOHEAD(fd,packet_len(0x20e));
WFIFOW(fd,0)=0x20e;
- malloc_tsetdword(WFIFOP(fd,2), 0, NAME_LENGTH); //Blank name as all was reset.
+ memset(WFIFOP(fd,2), 0, NAME_LENGTH); //Blank name as all was reset.
WFIFOL(fd,26)=sd->bl.id;
WFIFOB(fd,30)=0; //Feel/hate level: irrelevant
WFIFOB(fd,31)=30;
@@ -8606,7 +8606,7 @@ void check_fake_id(int fd, struct map_session_data *sd, int target_id) {
}
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
// send this info cause the bot ask until get an answer, damn spam
- malloc_tsetdword(WPACKETP(0), 0, packet_len(0x95));
+ memset(WPACKETP(0), 0, packet_len(0x95));
WPACKETW(0) = 0x95;
WPACKETL(2) = server_char_id;
strncpy(WPACKETP(6), sd->status.name, 24);
@@ -8647,7 +8647,7 @@ void check_fake_id(int fd, struct map_session_data *sd, int target_id) {
}
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
// send this info cause the bot ask until get an answer, damn spam
- malloc_tsetdword(WPACKETP(0), 0, packet_len(0x95));
+ memset(WPACKETP(0), 0, packet_len(0x95));
WPACKETW(0) = 0x95;
WPACKETL(2) = server_fake_mob_id;
fake_mob = fake_mob_list[(sd->bl.m + sd->fd + sd->status.char_id) % (sizeof(fake_mob_list) / sizeof(fake_mob_list[0]))]; // never same mob
@@ -10949,7 +10949,7 @@ void clif_parse_Shift(int fd, struct map_session_data *sd) { // Rewriten by [Yor
char player_name[NAME_LENGTH];
char message[MESSAGE_SIZE];
- malloc_tsetdword(player_name, '\0', sizeof(player_name));
+ memset(player_name, '\0', sizeof(player_name));
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_JumpTo))) {
@@ -10973,7 +10973,7 @@ void clif_parse_Recall(int fd, struct map_session_data *sd) { // Added by RoVeRT
char player_name[NAME_LENGTH];
char message[MESSAGE_SIZE];
- malloc_tsetdword(player_name, '\0', sizeof(player_name));
+ memset(player_name, '\0', sizeof(player_name));
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Recall))) {
@@ -10997,7 +10997,7 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) {
char monster_item_name[NAME_LENGTH+10]; //Additional space is for logging, eg: "@monster Poring"
int level;
- malloc_tsetdword(monster_item_name, '\0', sizeof(monster_item_name));
+ memset(monster_item_name, '\0', sizeof(monster_item_name));
if (battle_config.atc_gmonly == 0 || pc_isGM(sd)) {
RFIFOHEAD(fd);
@@ -11133,7 +11133,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
WFIFOHEAD(fd,packet_len(0xd1));
RFIFOHEAD(fd);
- malloc_tsetdword(output, '\0', sizeof(output));
+ memset(output, '\0', sizeof(output));
nick = (char*)RFIFOP(fd,2); // speed up
nick[NAME_LENGTH-1] = '\0'; // to be sure that the player name have at maximum 23 characters
@@ -11199,7 +11199,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
//Move everything one place down to overwrite removed entry.
memmove(sd->ignore[i].name, sd->ignore[i+1].name,
(MAX_IGNORE_LIST-i-1)*sizeof(sd->ignore[0].name));
- malloc_tsetdword(sd->ignore[MAX_IGNORE_LIST-1].name, 0, sizeof(sd->ignore[0].name));
+ memset(sd->ignore[MAX_IGNORE_LIST-1].name, 0, sizeof(sd->ignore[0].name));
// success
WFIFOB(fd,3) = 0;
WFIFOSET(fd, packet_len(0x0d1));
@@ -11516,7 +11516,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) {
for(j = i + 1; j < MAX_FRIENDS; j++)
memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0]));
- malloc_set(&sd->status.friends[MAX_FRIENDS-1], 0, sizeof(sd->status.friends[MAX_FRIENDS-1]));
+ memset(&sd->status.friends[MAX_FRIENDS-1], 0, sizeof(sd->status.friends[MAX_FRIENDS-1]));
clif_displaymessage(fd, "Friend removed");
WFIFOHEAD(fd,packet_len(0x20a));
@@ -12286,7 +12286,7 @@ static int packetdb_readdb(void)
if( skip_ver != 0 )
continue; // Skipping current packet version
- malloc_tsetdword(str,0,sizeof(str));
+ memset(str,0,sizeof(str));
for(j=0,p=line;j<4 && p;j++){
str[j]=p;
p=strchr(p,',');
@@ -12320,7 +12320,7 @@ static int packetdb_readdb(void)
for(i=0;i<MAX_PACKET_DB;i++){
if (packet_db[packet_ver][i].func == clif_parse_func[j].func)
{
- malloc_tsetword(&packet_db[packet_ver][i], 0, sizeof(struct packet_db));
+ memset(&packet_db[packet_ver][i], 0, sizeof(struct packet_db));
break;
}
}
@@ -12373,9 +12373,9 @@ static int packetdb_readdb(void)
int do_init_clif(void) {
clif_config.packet_db_ver = -1; // the main packet version of the DB
- malloc_tsetdword(clif_config.connect_cmd, 0, sizeof(clif_config.connect_cmd)); //The default connect command will be determined after reading the packet_db [Skotlex]
+ memset(clif_config.connect_cmd, 0, sizeof(clif_config.connect_cmd)); //The default connect command will be determined after reading the packet_db [Skotlex]
- malloc_tsetword(packet_db,0,sizeof(packet_db));
+ memset(packet_db,0,sizeof(packet_db));
//Using the packet_db file is the only way to set up packets now [Skotlex]
packetdb_readdb();
diff --git a/src/map/guild.c b/src/map/guild.c
index fc9defdbc..49d5dd0db 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -93,7 +93,7 @@ int guild_read_guildskill_tree_db(void)
FILE *fp;
char line[1024],*p;
- malloc_set(guild_skill_tree,0,sizeof(guild_skill_tree));
+ memset(guild_skill_tree,0,sizeof(guild_skill_tree));
sprintf(line, "%s/guild_skill_tree.txt", db_path);
if( (fp=fopen(line,"r"))==NULL){
ShowError("can't read %s\n", line);
@@ -169,7 +169,7 @@ static int guild_read_castledb(void)
while(fgets(line,1020,fp)){
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(str,0,sizeof(str));
+ memset(str,0,sizeof(str));
for(j=0,p=line;j<6 && p;j++){
str[j]=p;
p=strchr(p,',');
@@ -321,7 +321,7 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd)
{
nullpo_retv(sd);
- malloc_set(m,0,sizeof(struct guild_member));
+ memset(m,0,sizeof(struct guild_member));
m->account_id =sd->status.account_id;
m->char_id =sd->status.char_id;
m->hair =sd->status.hair;
@@ -840,7 +840,7 @@ int guild_member_leaved(int guild_id,int account_id,int char_id,int flag,
else
clif_guild_expulsion(online_member_sd, name, mes, account_id);
- malloc_set(&g->member[i],0,sizeof(struct guild_member));
+ memset(&g->member[i],0,sizeof(struct guild_member));
clif_guild_memberlist(online_member_sd);
if(sd != NULL && sd->status.guild_id == guild_id) {
diff --git a/src/map/irc.c b/src/map/irc.c
index 4722e9c2e..9989c3c31 100644
--- a/src/map/irc.c
+++ b/src/map/irc.c
@@ -63,7 +63,7 @@ int irc_connect_timer(int tid, unsigned int tick, int id, int data)
void irc_announce(char *buf)
{
char send_string[256];
- // malloc_tsetdword(send_string,'\0',256); // NOT REQUIRED
+ // memset(send_string,'\0',256); // NOT REQUIRED
sprintf(send_string,"PRIVMSG %s :",irc_channel);
strcat(send_string, buf);
@@ -75,7 +75,7 @@ void irc_announce_jobchange(struct map_session_data *sd)
char send_string[256];
nullpo_retv(sd);
- malloc_tsetdword(send_string,'\0',256);
+ memset(send_string,'\0',256);
sprintf(send_string,"PRIVMSG %s :%s has changed into a %s.",irc_channel,sd->status.name,job_name(sd->status.class_));
irc_send(send_string);
@@ -88,8 +88,8 @@ void irc_announce_shop(struct map_session_data *sd, int flag)
int maplen = 0;
nullpo_retv(sd);
- malloc_tsetdword(send_string,'\0',256);
- malloc_tsetdword(mapname,'\0',16);
+ memset(send_string,'\0',256);
+ memset(mapname,'\0',16);
if(flag){
strcpy(mapname, map[sd->bl.m].name);
@@ -113,8 +113,8 @@ void irc_announce_mvp(struct map_session_data *sd, struct mob_data *md)
nullpo_retv(sd);
nullpo_retv(md);
- malloc_tsetdword(send_string,'\0',256);
- malloc_tsetdword(mapname,'\0',16);
+ memset(send_string,'\0',256);
+ memset(mapname,'\0',16);
mapname[15]='\0'; // 15 is the final index, not 16 [Lance]
strcpy(mapname, map[md->bl.m].name);
maplen = strcspn(mapname,".");
@@ -156,7 +156,7 @@ int irc_parse(int fd)
int irc_keepalive_timer(int tid, unsigned int tick, int id, int data)
{
char send_string[128];
- malloc_tsetdword(send_string,'\0',128);
+ memset(send_string,'\0',128);
sprintf(send_string,"PRIVMSG %s : ", irc_nick);
irc_send(send_string);
@@ -179,7 +179,7 @@ void irc_send(char *buf)
if(!irc_si || !session[irc_si->fd])
return;
- malloc_tsetdword(transmit,'\0',4096);
+ memset(transmit,'\0',4096);
sprintf(transmit,buf);
irc_send_sub(irc_si->fd,transmit);
@@ -207,16 +207,16 @@ void irc_parse_sub(int fd, char *incoming_string)
struct map_session_data **allsd;
- malloc_tsetdword(source,'\0',256);
- malloc_tsetdword(command,'\0',256);
- malloc_tsetdword(target,'\0',256);
- malloc_tsetdword(message,'\0',8192);
- malloc_tsetdword(send_string,'\0',8192);
+ memset(source,'\0',256);
+ memset(command,'\0',256);
+ memset(target,'\0',256);
+ memset(message,'\0',8192);
+ memset(send_string,'\0',8192);
- malloc_tsetdword(cmd1,'\0',256);
- malloc_tsetdword(cmd2,'\0',256);
- malloc_tsetdword(cmdname,'\0',256);
- malloc_tsetdword(cmdargs,'\0',256);
+ memset(cmd1,'\0',256);
+ memset(cmd2,'\0',256);
+ memset(cmdname,'\0',256);
+ memset(cmdargs,'\0',256);
sscanf(incoming_string, ":%255s %255s %255s :%4095[^\r\n]", source, command, target, message);
if (source != NULL) {
@@ -371,11 +371,11 @@ int parse_names_packet(char *str) {
char channel[256];
char names[1024];
- malloc_tsetdword(source,'\0',256);
- malloc_tsetword(numeric,'\0',10);
- malloc_tsetdword(target,'\0',256);
- malloc_tsetdword(channel,'\0',256);
- malloc_tsetdword(names,'\0',1024);
+ memset(source,'\0',256);
+ memset(numeric,'\0',10);
+ memset(target,'\0',256);
+ memset(channel,'\0',256);
+ memset(names,'\0',1024);
tok=strtok(str,"\r\n");
sscanf(tok,":%255s %10s %255s %*1[=@] %255s :%1023[^\r\n]",source,numeric,target,channel,names);
@@ -478,7 +478,7 @@ int irc_rmnames() {
int i=0;
for(i=0;i<=MAX_CHANNEL_USERS;i++) {
- //malloc_tsetdword(cd.user[i].name,'\0',256);
+ //memset(cd.user[i].name,'\0',256);
cd.user[i].level=0;
}
@@ -495,10 +495,10 @@ int irc_read_conf(char *file) {
char path[256];
char row[1024];
- malloc_tsetdword(w1,'\0',256);
- malloc_tsetdword(w2,'\0',256);
- malloc_tsetdword(path,'\0',256);
- malloc_tsetdword(row,'\0',256);
+ memset(w1,'\0',256);
+ memset(w2,'\0',256);
+ memset(path,'\0',256);
+ memset(row,'\0',256);
sprintf(path,"conf/%s",file);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index f1cbdb3f5..2d4e9a3af 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -212,7 +212,7 @@ static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
}
static void create_dummy_data(void) {
- malloc_set(&dummy_item, 0, sizeof(struct item_data));
+ memset(&dummy_item, 0, sizeof(struct item_data));
dummy_item.nameid=500;
dummy_item.weight=1;
dummy_item.value_sell = 1;
@@ -431,7 +431,7 @@ static int itemdb_read_itemavail (void)
while (fgets(line, sizeof(line) - 1, fp)) {
if (line[0] == '/' && line[1] == '/')
continue;
- malloc_tsetdword(str, 0, sizeof(str));
+ memset(str, 0, sizeof(str));
for (j = 0, p = line; j < 2 && p; j++) {
str[j] = p;
p = strchr(p, ',');
@@ -485,7 +485,7 @@ static void itemdb_read_itemgroup_sub(const char* filename)
continue;
}
}
- malloc_tsetdword(str,0,sizeof(str));
+ memset(str,0,sizeof(str));
for(j=0,p=line;j<3 && p;j++){
str[j]=p;
p=strchr(p,',');
@@ -561,7 +561,7 @@ static void itemdb_read_itemgroup(void)
"Gift Box China",
"Lotto Box",
};
- malloc_tsetdword(&itemgroup_db, 0, sizeof(itemgroup_db));
+ memset(&itemgroup_db, 0, sizeof(itemgroup_db));
snprintf(path, 255, "%s/item_group_db.txt", db_path);
itemdb_read_itemgroup_sub(path);
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","item_group_db.txt");
@@ -739,7 +739,7 @@ static int itemdb_read_noequip(void)
while(fgets(line,1020,fp)){
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(str,0,sizeof(str));
+ memset(str,0,sizeof(str));
for(j=0,p=line;j<2 && p;j++){
str[j]=p;
p=strchr(p,',');
@@ -784,7 +784,7 @@ static int itemdb_read_itemtrade(void)
while (fgets(line, sizeof(line) - 1, fp)) {
if (line[0] == '/' && line[1] == '/')
continue;
- malloc_tsetdword(str, 0, sizeof(str));
+ memset(str, 0, sizeof(str));
for (j = 0, p = line; j < 3 && p; j++) {
str[j] = p;
p = strchr(p, ',');
@@ -1039,7 +1039,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<19 && p;j++){
str[j]=p;
p=strchr(p,',');
diff --git a/src/map/log.c b/src/map/log.c
index ff1487d0c..de7410011 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -393,7 +393,7 @@ int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map,
void log_set_defaults(void)
{
- malloc_set(&log_config, 0, sizeof(log_config));
+ memset(&log_config, 0, sizeof(log_config));
//LOG FILTER Default values
log_config.refine_items_log = 5; //log refined items, with refine >= +7
diff --git a/src/map/map.c b/src/map/map.c
index d580dd09c..f17b05e02 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2570,7 +2570,7 @@ static int map_cache_open(char *fn)
// 読み甲ンに失敗したので新規に作成する
map_cache.fp = fopen(fn,"wb");
if(map_cache.fp) {
- malloc_set(&map_cache.head,0,sizeof(struct map_cache_head));
+ memset(&map_cache.head,0,sizeof(struct map_cache_head));
map_cache.map = (struct map_cache_info *) aCalloc(sizeof(struct map_cache_info),MAX_MAP_CACHE);
map_cache.head.nmaps = MAX_MAP_CACHE;
map_cache.head.sizeof_header = sizeof(struct map_cache_head);
@@ -3135,7 +3135,7 @@ int map_readallmaps (void)
// pre-init some data
map[i].alias = NULL;
map[i].m = i;
- malloc_set (map[i].moblist, 0, sizeof(map[i].moblist)); //Initialize moblist [Skotlex]
+ memset (map[i].moblist, 0, sizeof(map[i].moblist)); //Initialize moblist [Skotlex]
map[i].mob_delete_timer = -1; //Initialize timer [Skotlex]
if (battle_config.pk_mode)
map[i].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
@@ -3253,7 +3253,7 @@ int parse_console(char *buf) {
int m, n;
struct map_session_data sd;
- malloc_set(&sd, 0, sizeof(struct map_session_data));
+ memset(&sd, 0, sizeof(struct map_session_data));
strcpy( sd.status.name , "console");
if ( ( n = sscanf(buf, "%[^:]:%[^:]:%99s %d %d[^\n]", type , command , map , &x , &y )) < 5 )
diff --git a/src/map/map.h b/src/map/map.h
index f9e59cbff..70b5df912 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -432,7 +432,7 @@ struct vending {
struct weapon_data {
int atkmods[3];
// all the variables except atkmods get zero'ed in each call of status_calc_pc
- // NOTE: if you want to add a non-zeroed variable, you need to update the malloc_set call
+ // NOTE: if you want to add a non-zeroed variable, you need to update the memset call
// in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex]
int overrefine;
int star;
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 99ca1017e..8486c0335 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -752,7 +752,7 @@ int read_homunculusdb(void)
char *filename[]={"homunculus_db.txt","homunculus_db2.txt"};
char *str[36];
- malloc_set(homunculus_db,0,sizeof(homunculus_db));
+ memset(homunculus_db,0,sizeof(homunculus_db));
for(i = 0; i<2; i++)
{
sprintf(line, "%s/%s", db_path, filename[i]);
@@ -839,7 +839,7 @@ int read_homunculus_skilldb(void)
int j = 0;
char *split[15];
- malloc_tsetdword(hskill_tree,0,sizeof(hskill_tree));
+ memset(hskill_tree,0,sizeof(hskill_tree));
sprintf(line, "%s/homun_skill_tree.txt", db_path);
fp=fopen(line,"r");
if(fp==NULL){
@@ -906,7 +906,7 @@ void read_homunculus_expdb(void)
int i, j=0;
char *filename[]={"exp_homun.txt","exp_homun2.txt"};
- malloc_tsetdword(hexptbl,0,sizeof(hexptbl));
+ memset(hexptbl,0,sizeof(hexptbl));
for(i=0; i<2; i++){
sprintf(line, "%s/%s", db_path, filename[i]);
fp=fopen(line,"r");
diff --git a/src/map/mob.c b/src/map/mob.c
index f2fdaabe2..ab6a7d58d 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -274,7 +274,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m,
{
struct spawn_data data;
- malloc_set(&data, 0, sizeof(struct spawn_data));
+ memset(&data, 0, sizeof(struct spawn_data));
data.m = m;
data.num = 1;
data.class_ = class_;
@@ -463,7 +463,7 @@ int mob_spawn_guardian(struct map_session_data *sd,char *mapname,
struct guild *g=NULL;
struct guild_castle *gc;
int m, count;
- malloc_set(&data, 0, sizeof(struct spawn_data));
+ memset(&data, 0, sizeof(struct spawn_data));
data.num = 1;
if( sd && strcmp(mapname,"this")==0)
@@ -679,7 +679,7 @@ int mob_spawn (struct mob_data *md)
return 1;
}
}
- malloc_set(&md->state, 0, sizeof(md->state));
+ memset(&md->state, 0, sizeof(md->state));
status_calc_mob(md, 1);
md->attacked_id = 0;
md->target_id = 0;
@@ -696,10 +696,10 @@ int mob_spawn (struct mob_data *md)
for (i = 0, c = tick-1000*3600*10; i < MAX_MOBSKILL; i++)
md->skilldelay[i] = c;
- malloc_set(md->dmglog, 0, sizeof(md->dmglog));
+ memset(md->dmglog, 0, sizeof(md->dmglog));
md->tdmg = 0;
if (md->lootitem)
- malloc_set(md->lootitem, 0, sizeof(md->lootitem));
+ memset(md->lootitem, 0, sizeof(md->lootitem));
md->lootitem_count = 0;
if(md->db->option)
@@ -1419,7 +1419,7 @@ static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
static struct item_drop* mob_setdropitem(int nameid, int qty)
{
struct item_drop *drop = ers_alloc(item_drop_ers, struct item_drop);
- malloc_set(&drop->item_data, 0, sizeof(struct item));
+ memset(&drop->item_data, 0, sizeof(struct item));
drop->item_data.nameid = nameid;
drop->item_data.amount = qty;
drop->item_data.identify = itemdb_isidentified(nameid);
@@ -1728,8 +1728,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
map_freeblock_lock();
- malloc_tsetdword(tmpsd,0,sizeof(tmpsd));
- malloc_set(pt,0,sizeof(pt));
+ memset(tmpsd,0,sizeof(tmpsd));
+ memset(pt,0,sizeof(pt));
if(src && src->type == BL_MOB)
mob_unlocktarget((struct mob_data *)src,tick);
@@ -2088,7 +2088,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if(temp <= rand()%10000+1) //if ==0, then it doesn't drop
continue;
- malloc_set(&item,0,sizeof(item));
+ memset(&item,0,sizeof(item));
item.nameid=md->db->mvpitem[i].nameid;
item.identify= itemdb_isidentified(item.nameid);
clif_mvp_item(mvp_sd,item.nameid);
@@ -2330,7 +2330,7 @@ int mob_class_change (struct mob_data *md, int class_)
status_calc_mob(md, 3);
if (battle_config.monster_class_change_full_recover) {
- malloc_set(md->dmglog, 0, sizeof(md->dmglog));
+ memset(md->dmglog, 0, sizeof(md->dmglog));
md->tdmg = 0;
} else {
md->status.hp = md->status.max_hp*hp_rate/100;
@@ -2437,7 +2437,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id)
nullpo_retr(0, md2);
nullpo_retr(0, value);
- malloc_set(&data, 0, sizeof(struct spawn_data));
+ memset(&data, 0, sizeof(struct spawn_data));
data.m = md2->bl.m;
data.x = md2->bl.x;
data.y = md2->bl.y;
@@ -2950,7 +2950,7 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char
skill_get_unit_flag(skill_id)&(UF_NOMOB|UF_NOPC))
continue;
- malloc_set (&ms[i], 0, sizeof(struct mob_skill));
+ memset (&ms[i], 0, sizeof(struct mob_skill));
ms[i].skill_id = skill_id;
ms[i].skill_lv = sd->status.skill[skill_id].lv;
ms[i].state = MSS_ANY;
@@ -3482,7 +3482,7 @@ static int mob_readdb_mobavail(void)
while(fgets(line,1020,fp)){
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(str,0,sizeof(str));
+ memset(str,0,sizeof(str));
for(j=0,p=line;j<12;j++){
if((np=strchr(p,','))!=NULL){
@@ -3507,7 +3507,7 @@ static int mob_readdb_mobavail(void)
if(k < 0)
continue;
- malloc_set(&mob_db_data[class_]->vd, 0, sizeof(struct view_data));
+ memset(&mob_db_data[class_]->vd, 0, sizeof(struct view_data));
mob_db_data[class_]->vd.class_=k;
//Player sprites
@@ -3561,7 +3561,7 @@ static int mob_read_randommonster(void)
int class_,per;
if(line[0] == '/' && line[1] == '/')
continue;
- malloc_tsetdword(str,0,sizeof(str));
+ memset(str,0,sizeof(str));
for(j=0,p=line;j<3 && p;j++){
str[j]=p;
p=strchr(p,',');
@@ -3686,7 +3686,7 @@ static int mob_readskilldb(void)
if(line[0] == '/' && line[1] == '/')
continue;
- malloc_tsetdword(sp,0,sizeof(sp));
+ memset(sp,0,sizeof(sp));
for(i=0,p=line;i<18 && p;i++){
sp[i]=p;
if((p=strchr(p,','))!=NULL)
@@ -3709,14 +3709,14 @@ static int mob_readskilldb(void)
if( strcmp(sp[1],"clear")==0 ){
if (mob_id < 0)
continue;
- malloc_set(mob_db_data[mob_id]->skill,0,sizeof(struct mob_skill));
+ memset(mob_db_data[mob_id]->skill,0,sizeof(struct mob_skill));
mob_db_data[mob_id]->maxskill=0;
continue;
}
if (mob_id < 0)
{ //Prepare global skill. [Skotlex]
- malloc_set(&gms, 0, sizeof (struct mob_skill));
+ memset(&gms, 0, sizeof (struct mob_skill));
ms = &gms;
} else {
for(i=0;i<MAX_MOBSKILL;i++)
@@ -3867,7 +3867,7 @@ static int mob_readdb_race(void)
while(fgets(line,1020,fp)){
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(str,0,sizeof(str));
+ memset(str,0,sizeof(str));
for(j=0,p=line;j<12;j++){
if((np=strchr(p,','))!=NULL){
@@ -4183,7 +4183,7 @@ void mob_reload(void)
for (i = 0; i < MAX_MOB_DB; i++)
if (mob_db_data[i])
{
- malloc_set(&mob_db_data[i]->skill,0,sizeof(mob_db_data[i]->skill));
+ memset(&mob_db_data[i]->skill,0,sizeof(mob_db_data[i]->skill));
mob_db_data[i]->maxskill=0;
}
mob_readskilldb();
@@ -4196,7 +4196,7 @@ void mob_reload(void)
*/
int do_init_mob(void)
{ //Initialize the mob database
- malloc_set(mob_db_data,0,sizeof(mob_db_data)); //Clear the array
+ memset(mob_db_data,0,sizeof(mob_db_data)); //Clear the array
mob_db_data[0] = aCalloc(1, sizeof (struct mob_data)); //This mob is used for random spawns
mob_makedummymobdb(0); //The first time this is invoked, it creates the dummy mob
item_drop_ers = ers_new(sizeof(struct item_drop));
diff --git a/src/map/npc.c b/src/map/npc.c
index 7b7557a10..b90886da6 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1252,7 +1252,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
for(i=0;i<n;i++) {
struct item item_tmp;
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = item_list[i*2+1];
item_tmp.identify = 1; // npc販売アイテムは鑑定済み
@@ -1845,7 +1845,7 @@ static int npc_skip_script (char *w1,char *w2,char *w3,char *w4,char *first_line
if (strlen((char *)srcbuf) + strlen((char *)line) + 1 >= (size_t)srcsize) {
srcsize += 65536;
srcbuf = (unsigned char *)aRealloc(srcbuf, srcsize);
- malloc_tsetdword(srcbuf + srcsize - 65536, '\0', 65536);
+ memset(srcbuf + srcsize - 65536, '\0', 65536);
}
if (srcbuf[0] != '{') {
if (strchr((char *) line,'{')) {
@@ -1909,7 +1909,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
if (strlen((char *)srcbuf) + strlen((char *)line) + 1 >= (size_t)srcsize) {
srcsize += 65536;
srcbuf = (unsigned char *)aRealloc(srcbuf, srcsize);
- malloc_tsetdword(srcbuf + srcsize - 65536, '\0', 65536);
+ memset(srcbuf + srcsize - 65536, '\0', 65536);
}
if (srcbuf[0] != '{') {
if (strchr((char *) line,'{')) {
@@ -2147,7 +2147,7 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *fir
if (strlen(srcbuf)+strlen(line)+1 >= (unsigned int)srcsize) {
srcsize += 65536;
srcbuf = (char *)aRealloc(srcbuf, srcsize);
- malloc_tsetdword(srcbuf + srcsize - 65536, '\0', 65536);
+ memset(srcbuf + srcsize - 65536, '\0', 65536);
}
if (srcbuf[0]!='{') {
if (strchr(line,'{')) {
@@ -2224,7 +2224,7 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
char mobname[NAME_LENGTH];
struct spawn_data mob, *data;
- malloc_set(&mob, 0, sizeof(struct spawn_data));
+ memset(&mob, 0, sizeof(struct spawn_data));
// 引数の個数チェック
if (sscanf(w1, "%15[^,],%d,%d,%d,%d", mapname, &x, &y, &xs, &ys) < 3 ||
@@ -2876,7 +2876,7 @@ int npc_reload (void)
if(battle_config.dynamic_mobs) { //dynamic check by [random]
for (i = 0; i < MAX_MOB_LIST_PER_MAP; i++)
if (map[m].moblist[i]) aFree(map[m].moblist[i]);
- malloc_set (map[m].moblist, 0, sizeof(map[m].moblist));
+ memset (map[m].moblist, 0, sizeof(map[m].moblist));
}
if (map[m].npc_num > 0 && battle_config.error_log)
ShowWarning("npc_reload: %d npcs weren't removed at map %s!\n", map[m].npc_num, map[m].name);
@@ -3008,7 +3008,7 @@ int do_init_npc(void)
char c = '-';
//Stock view data for normal npcs.
- malloc_set(&npc_viewdb, 0, sizeof(npc_viewdb));
+ memset(&npc_viewdb, 0, sizeof(npc_viewdb));
npc_viewdb[0].class_ = INVISIBLE_CLASS; //Invisible class is stored here.
for (busy = 1; busy < MAX_NPC_CLASS; busy++)
npc_viewdb[busy].class_ = busy;
@@ -3022,7 +3022,7 @@ int do_init_npc(void)
ev_db = db_alloc(__FILE__,__LINE__,DB_STRING,DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA,51);
npcname_db = db_alloc(__FILE__,__LINE__,DB_STRING,DB_OPT_BASE,NAME_LENGTH);
- malloc_set(&ev_tm_b, -1, sizeof(ev_tm_b));
+ memset(&ev_tm_b, -1, sizeof(ev_tm_b));
timer_event_ers = ers_new(sizeof(struct timer_event_data));
for (nsl = npc_src_first; nsl; nsl = nsl->next) {
@@ -3056,7 +3056,7 @@ int do_init_npc(void)
CL_WHITE"%d"CL_RESET"' Mobs Not Cached\n",
npc_id - START_NPC_NUM, "", npc_warp, npc_shop, npc_script, npc_mob, npc_cache_mob, npc_delay_mob);
- malloc_set(script_event, 0, sizeof(script_event));
+ memset(script_event, 0, sizeof(script_event));
npc_read_event_script();
//Debug function to locate all endless loop warps.
if (battle_config.warp_point_debug)
diff --git a/src/map/party.c b/src/map/party.c
index 87bd3ad62..558615e9c 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -190,7 +190,7 @@ static void* create_party(DBKey key, va_list args) {
static void party_check_state(struct party_data *p)
{
int i;
- malloc_set(&p->state, 0, sizeof(p->state));
+ memset(&p->state, 0, sizeof(p->state));
for (i = 0; i < MAX_PARTY; i ++)
{
if (!p->party.member[i].online) continue; //Those not online shouldn't aport to skill usage and all that.
@@ -226,8 +226,8 @@ int party_recv_info(struct party *sp)
if (!p->party.party_id) //party just received.
party_check_member(sp);
memcpy(&p->party,sp,sizeof(struct party));
- malloc_set(&p->state, 0, sizeof(p->state));
- malloc_set(&p->data, 0, sizeof(p->data));
+ memset(&p->state, 0, sizeof(p->state));
+ memset(&p->data, 0, sizeof(p->data));
for(i=0;i<MAX_PARTY;i++){
if (!p->party.member[i].account_id)
continue;
@@ -415,8 +415,8 @@ int party_member_leaved(int party_id,int account_id,int char_id)
if(p->party.member[i].account_id==account_id &&
p->party.member[i].char_id==char_id){
clif_party_leaved(p,sd,account_id,p->party.member[i].name,0x00);
- malloc_set(&p->party.member[i], 0, sizeof(p->party.member[0]));
- malloc_set(&p->data[i], 0, sizeof(p->data[0]));
+ memset(&p->party.member[i], 0, sizeof(p->party.member[0]));
+ memset(&p->data[i], 0, sizeof(p->data[0]));
p->party.count--;
party_check_state(p);
break;
@@ -563,7 +563,7 @@ int party_send_logout(struct map_session_data *sd)
for(i=0;i<MAX_PARTY && p->data[i].sd != sd;i++);
if (i < MAX_PARTY)
- malloc_set(&p->data[i], 0, sizeof(p->data[0]));
+ memset(&p->data[i], 0, sizeof(p->data[0]));
return 1;
}
diff --git a/src/map/path.c b/src/map/path.c
index 550defaa8..838d00a4a 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -377,7 +377,7 @@ int path_search_real(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1
if(flag&1)
return -1;
- malloc_set(tp,0,sizeof(tp));
+ memset(tp,0,sizeof(tp));
i=calc_index(x0,y0);
tp[i].x=x0;
diff --git a/src/map/pc.c b/src/map/pc.c
index 0434d3377..656555136 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1175,7 +1175,7 @@ static int pc_bonus_autospell_del(struct s_autospell *spell, int max, short id,
rate-= spell[i].rate;
spell[i].rate = 0;
memmove(&spell[i], &spell[j], sizeof(struct s_autospell));
- malloc_set(&spell[j], 0, sizeof(struct s_autospell));
+ memset(&spell[j], 0, sizeof(struct s_autospell));
j--;
} else {
spell[i].rate -= rate;
@@ -2734,7 +2734,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type)
if(sd->status.inventory[n].amount<=0){
if(sd->status.inventory[n].equip)
pc_unequipitem(sd,n,3);
- malloc_set(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
+ memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
sd->inventory_data[n] = NULL;
}
if(!(type&1))
@@ -3077,7 +3077,7 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type)
sd->status.cart[n].amount -= amount;
sd->cart_weight -= itemdb_weight(sd->status.cart[n].nameid)*amount ;
if(sd->status.cart[n].amount <= 0){
- malloc_set(&sd->status.cart[n],0,sizeof(sd->status.cart[0]));
+ memset(&sd->status.cart[n],0,sizeof(sd->status.cart[0]));
sd->cart_num--;
}
if(!type) {
@@ -3225,7 +3225,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
return 0;
itemid = md->db->dropitem[i].nameid;
- malloc_set(&tmp_item,0,sizeof(tmp_item));
+ memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = itemid;
tmp_item.amount = 1;
tmp_item.identify = itemdb_isidentified(itemid);
@@ -4938,7 +4938,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
/*
if(sd->status.karma > 0) {
int eq_num=0,eq_n[MAX_INVENTORY];
- malloc_set(eq_n,0,sizeof(eq_n));
+ memset(eq_n,0,sizeof(eq_n));
for(i=0;i<MAX_INVENTORY;i++){
int k;
for(k=0;k<MAX_INVENTORY;k++){
@@ -4964,7 +4964,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
|| (battle_config.bone_drop==1 && map[sd->bl.m].flag.pvp))
{
struct item item_tmp;
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid=7420; //PVP Skull item ID
item_tmp.identify=1;
item_tmp.card[0]=CARD0_CREATE;
@@ -5046,7 +5046,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
continue;
if(id == -1){
int eq_num=0,eq_n[MAX_INVENTORY];
- malloc_tsetdword(eq_n,0,sizeof(eq_n));
+ memset(eq_n,0,sizeof(eq_n));
for(i=0;i<MAX_INVENTORY;i++){
int k;
if( (type == 1 && !sd->status.inventory[i].equip)
@@ -5857,7 +5857,7 @@ int pc_setreg(struct map_session_data *sd,int reg,int val)
}
sd->reg_num++;
sd->reg = (struct script_reg *) aRealloc(sd->reg, sizeof(*(sd->reg)) * sd->reg_num);
- malloc_set(sd->reg + (sd->reg_num - 1), 0, sizeof(struct script_reg));
+ memset(sd->reg + (sd->reg_num - 1), 0, sizeof(struct script_reg));
sd->reg[i].index = reg;
sd->reg[i].data = val;
@@ -5907,7 +5907,7 @@ int pc_setregstr(struct map_session_data *sd,int reg,char *str)
ShowFatalError("out of memory : pc_setreg\n");
exit(1);
}
- malloc_set(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr));
+ memset(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr));
sd->regstr[i].index = reg;
strcpy(sd->regstr[i].data, str);
@@ -6035,7 +6035,7 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type)
if (strcmp(sd_reg[i].str, reg) == 0) {
if (i != *max - 1)
memcpy(&sd_reg[i], &sd_reg[*max - 1], sizeof(struct global_reg));
- malloc_tsetdword(&sd_reg[*max - 1], 0, sizeof(struct global_reg));
+ memset(&sd_reg[*max - 1], 0, sizeof(struct global_reg));
(*max)--;
sd->state.reg_dirty |= 1<<(type-1); //Mark this registry as "need to be saved"
break;
@@ -6054,7 +6054,7 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type)
// add value if not found
if (i < regmax) {
- malloc_tsetdword(&sd_reg[i], 0, sizeof(struct global_reg));
+ memset(&sd_reg[i], 0, sizeof(struct global_reg));
strncpy(sd_reg[i].str, reg, 32);
sprintf(sd_reg[i].value, "%d", val);
(*max)++;
@@ -6110,7 +6110,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type)
if (strcmp(sd_reg[i].str, reg) == 0) {
if (i != *max - 1)
memcpy(&sd_reg[i], &sd_reg[*max - 1], sizeof(struct global_reg));
- malloc_tsetdword(&sd_reg[*max - 1], 0, sizeof(struct global_reg));
+ memset(&sd_reg[*max - 1], 0, sizeof(struct global_reg));
(*max)--;
sd->state.reg_dirty |= 1<<(type-1); //Mark this registry as "need to be saved"
if (type!=3) intif_saveregistry(sd,type);
@@ -6131,7 +6131,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type)
// add value if not found
if (i < regmax) {
- malloc_tsetdword(&sd_reg[i], 0, sizeof(struct global_reg));
+ memset(&sd_reg[i], 0, sizeof(struct global_reg));
strncpy(sd_reg[i].str, reg, 32);
strncpy(sd_reg[i].value, val, 256);
(*max)++;
@@ -6558,7 +6558,7 @@ int pc_checkitem(struct map_session_data *sd)
j++;
}
if(j < MAX_INVENTORY)
- malloc_set(&sd->status.inventory[j],0,sizeof(struct item)*(MAX_INVENTORY-j));
+ memset(&sd->status.inventory[j],0,sizeof(struct item)*(MAX_INVENTORY-j));
for(k=j;k<MAX_INVENTORY;k++)
sd->inventory_data[k] = NULL;
@@ -6578,7 +6578,7 @@ int pc_checkitem(struct map_session_data *sd)
j++;
}
if(j < MAX_CART)
- malloc_set(&sd->status.cart[j],0,sizeof(struct item)*(MAX_CART-j));
+ memset(&sd->status.cart[j],0,sizeof(struct item)*(MAX_CART-j));
// ? 備位置チェック
@@ -7274,8 +7274,8 @@ int pc_readdb(void)
char line[24000],*p;
// 必要??値?み?み
- malloc_tsetword(exp_table,0,sizeof(exp_table));
- malloc_tsetword(max_level,0,sizeof(max_level));
+ memset(exp_table,0,sizeof(exp_table));
+ memset(max_level,0,sizeof(max_level));
sprintf(line, "%s/exp.txt", db_path);
fp=fopen(line, "r");
if(fp==NULL){
@@ -7352,7 +7352,7 @@ int pc_readdb(void)
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","exp.txt");
// スキルツリ?
- malloc_set(skill_tree,0,sizeof(skill_tree));
+ memset(skill_tree,0,sizeof(skill_tree));
sprintf(line, "%s/skill_tree.txt", db_path);
fp=fopen(line,"r");
if(fp==NULL){
@@ -7446,7 +7446,7 @@ int pc_readdb(void)
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","attr_fix.txt");
// スキルツリ?
- malloc_set(statp,0,sizeof(statp));
+ memset(statp,0,sizeof(statp));
i=1;
j=45; // base points
sprintf(line, "%s/statpoint.txt", db_path);
@@ -7482,7 +7482,7 @@ int pc_read_motd(void) {
FILE *fp;
int ln=0,i=0;
- malloc_set(motd_text,0,sizeof(motd_text));
+ memset(motd_text,0,sizeof(motd_text));
if ((fp = fopen(motd_txt, "r")) != NULL) {
while ((ln < MOTD_LINE_SIZE) && fgets(motd_text[ln], sizeof(motd_text[ln])-1, fp) != NULL) {
if(motd_text[ln][0] == '/' && motd_text[ln][1] == '/')
diff --git a/src/map/pet.c b/src/map/pet.c
index 50433aab3..06ca24049 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -343,7 +343,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
int flag;
pet_lootitem_drop(pd,sd);
- malloc_set(&tmp_item,0,sizeof(tmp_item));
+ memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = pd->petDB->EggID;
tmp_item.identify = 1;
tmp_item.card[0] = CARD0_PET;
@@ -634,7 +634,7 @@ int pet_get_egg(int account_id,int pet_id,int flag)
return 0;
}
- malloc_set(&tmp_item,0,sizeof(tmp_item));
+ memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = pet_db[i].EggID;
tmp_item.identify = 1;
tmp_item.card[0] = CARD0_PET;
@@ -762,7 +762,7 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
pd->pet.equip = 0;
status_set_viewdata(&pd->bl, pd->pet.class_);
clif_pet_equip(pd);
- malloc_set(&tmp_item,0,sizeof(tmp_item));
+ memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = nameid;
tmp_item.identify = 1;
if((flag = pc_additem(sd,&tmp_item,1))) {
@@ -1089,7 +1089,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
}
}
//The smart thing to do is use pd->loot->max (thanks for pointing it out, Shinomori)
- malloc_set(pd->loot->item,0,pd->loot->max * sizeof(struct item));
+ memset(pd->loot->item,0,pd->loot->max * sizeof(struct item));
pd->loot->count = 0;
pd->loot->weight = 0;
pd->ud.canact_tick = gettick()+10000; // 10*1000msの間拾わない
@@ -1288,7 +1288,7 @@ int read_petdb()
pet_db[j].script = NULL;
}
j = 0;
- malloc_set(pet_db,0,sizeof(pet_db));
+ memset(pet_db,0,sizeof(pet_db));
for(i=0;i<2;i++){
sprintf(line, "%s/%s", db_path, filename[i]);
fp=fopen(line,"r");
@@ -1368,7 +1368,7 @@ int read_petdb()
*/
int do_init_pet(void)
{
- malloc_set(pet_db,0,sizeof(pet_db));
+ memset(pet_db,0,sizeof(pet_db));
read_petdb();
item_drop_ers = ers_new(sizeof(struct item_drop));
diff --git a/src/map/script.c b/src/map/script.c
index dd2c07ef9..4b84f6c72 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -382,13 +382,13 @@ int add_str(const char* p)
if(str_num>=str_data_size){
str_data_size+=128;
RECREATE(str_data,struct str_data_struct,str_data_size);
- malloc_tsetdword(str_data + (str_data_size - 128), '\0', 128);
+ memset(str_data + (str_data_size - 128), '\0', 128);
}
len=(int)strlen(p);
while(str_pos+len+1>=str_size){
str_size+=256;
RECREATE(str_buf,char,str_size);
- malloc_tsetdword(str_buf + (str_size - 256), '\0', 256);
+ memset(str_buf + (str_size - 256), '\0', 256);
}
memcpy(str_buf+str_pos,p,len+1);
str_data[str_num].type=C_NOP;
@@ -1662,7 +1662,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
struct script_code *code;
static int first=1;
- malloc_set(&syntax,0,sizeof(syntax));
+ memset(&syntax,0,sizeof(syntax));
if(first){
add_buildin_func();
read_constdb();
@@ -2097,7 +2097,7 @@ void push_val(struct script_stack *stack,int type,int val)
stack->sp_max += 64;
stack->stack_data = (struct script_data *)aRealloc(stack->stack_data,
sizeof(stack->stack_data[0]) * stack->sp_max);
- malloc_tsetdword(stack->stack_data + (stack->sp_max - 64), 0,
+ memset(stack->stack_data + (stack->sp_max - 64), 0,
64 * sizeof(*(stack->stack_data)));
}
// if(battle_config.etc_log)
@@ -2128,7 +2128,7 @@ void push_str(struct script_stack *stack,int type,char *str)
stack->sp_max += 64;
stack->stack_data = (struct script_data *)aRealloc(stack->stack_data,
sizeof(stack->stack_data[0]) * stack->sp_max);
- malloc_tsetdword(stack->stack_data + (stack->sp_max - 64), '\0',
+ memset(stack->stack_data + (stack->sp_max - 64), '\0',
64 * sizeof(*(stack->stack_data)));
}
// if(battle_config.etc_log)
@@ -3297,7 +3297,7 @@ int script_config_read_sub(char *cfgName)
int script_config_read(char *cfgName)
{ //Script related variables should be initialized once! [Skotlex]
- malloc_set (&script_config, 0, sizeof(script_config));
+ memset (&script_config, 0, sizeof(script_config));
script_config.verbose_mode = 0;
script_config.warn_func_mismatch_paramnum = 1;
script_config.check_cmdcount = 65535;
@@ -5356,7 +5356,7 @@ int buildin_getitem(struct script_state *st)
if( (amount=conv_num(st, script_getdata(st,3))) <= 0)
return 0; //return if amount <=0, skip the useles iteration
- malloc_set(&it,0,sizeof(it));
+ memset(&it,0,sizeof(it));
it.nameid=nameid;
if(!flag)
it.identify=1;
@@ -5431,7 +5431,7 @@ int buildin_getitem2(struct script_state *st)
}
if(nameid > 0) {
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_data=itemdb_exists(nameid);
if (item_data == NULL)
return -1;
@@ -5525,7 +5525,7 @@ int buildin_getnameditem(struct script_state *st)
return 0;
}
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid=nameid;
item_tmp.amount=1;
item_tmp.identify=1;
@@ -5602,7 +5602,7 @@ int buildin_makeitem(struct script_state *st)
}
if(nameid > 0) {
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid=nameid;
if(!flag)
item_tmp.identify=1;
@@ -10348,7 +10348,7 @@ int buildin_atcommand(struct script_state *st)
} else { //Use a dummy character.
struct map_session_data dummy_sd;
struct block_list *bl = NULL;
- malloc_set(&dummy_sd, 0, sizeof(struct map_session_data));
+ memset(&dummy_sd, 0, sizeof(struct map_session_data));
if (st->oid) bl = map_id2bl(st->oid);
if (bl) {
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
@@ -10386,7 +10386,7 @@ int buildin_charcommand(struct script_state *st)
} else { //Use a dummy character.
struct map_session_data dummy_sd;
struct block_list *bl = NULL;
- malloc_set(&dummy_sd, 0, sizeof(struct map_session_data));
+ memset(&dummy_sd, 0, sizeof(struct map_session_data));
if (st->oid) bl = map_id2bl(st->oid);
if (bl) {
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
@@ -10927,7 +10927,7 @@ int buildin_getmapxy(struct script_state *st){
int x,y,type;
char mapname[MAP_NAME_LENGTH+1];
- malloc_set(mapname, 0, sizeof(mapname));
+ memset(mapname, 0, sizeof(mapname));
if( st->stack->stack_data[st->start+2].type!=C_NAME ){
ShowWarning("script: buildin_getmapxy: not mapname variable\n");
@@ -11656,7 +11656,7 @@ int buildin_query_sql(struct script_state *st) {
return 1;
}
- malloc_set(row, 0, sizeof(row));
+ memset(row, 0, sizeof(row));
// Verify argument types
for(j=0; j < nb_rows; j++)
{
@@ -11835,7 +11835,7 @@ int buildin_npcshopitem(struct script_state *st)
sizeof(nd->u.shop_item[0]) * amount);
// Reset sell list.
- malloc_set(nd->u.shop_item, 0, sizeof(nd->u.shop_item[0]) * amount);
+ memset(nd->u.shop_item, 0, sizeof(nd->u.shop_item[0]) * amount);
n = 0;
diff --git a/src/map/skill.c b/src/map/skill.c
index 77d3c185c..81788c88a 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4440,8 +4440,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
struct item item_tmp;
struct block_list tbl;
clif_skill_nodamage(src,bl,skillid,skilllv,1);
- malloc_set(&item_tmp,0,sizeof(item_tmp));
- malloc_set(&tbl,0,sizeof(tbl)); // [MouseJstr]
+ memset(&item_tmp,0,sizeof(item_tmp));
+ memset(&tbl,0,sizeof(tbl)); // [MouseJstr]
item_tmp.nameid = 7049;
item_tmp.identify = 1;
tbl.id = 0;
@@ -5004,7 +5004,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if(battle_config.skill_removetrap_type){
for(i=0;i<10;i++) {
if(skill_db[su->group->skill_id].itemid[i] > 0){
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = skill_db[su->group->skill_id].itemid[i];
item_tmp.identify = 1;
if(item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i]))){
@@ -5014,7 +5014,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
}
}else{
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = 1065;
item_tmp.identify = 1;
if(item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,1))){
@@ -7765,7 +7765,7 @@ int skill_check_pc_partner (struct map_session_data *sd, int skill_id, int* skil
}
//Else: new search for partners.
c = 0;
- malloc_tsetdword (p_sd, 0, sizeof(p_sd));
+ memset (p_sd, 0, sizeof(p_sd));
i = map_foreachinrange(skill_check_condition_char_sub, &sd->bl,
range, BL_PC, &sd->bl, &c, &p_sd, skill_id);
@@ -10044,7 +10044,7 @@ int skill_unit_timer_sub (struct block_list *bl, va_list ap)
if(src && src->type==BL_PC && !group->state.into_abyss)
{ //Avoid generating trap items when it did not cost to create them. [Skotlex]
struct item item_tmp;
- malloc_set(&item_tmp,0,sizeof(item_tmp));
+ memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid=1065;
item_tmp.identify=1;
map_addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,NULL,NULL,NULL,0);
@@ -10211,7 +10211,7 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag)
if (flag&2 && !(flag&1))
{ //Onout, clear data
- malloc_tsetdword (&skill_unit_temp,0,sizeof(skill_unit_temp));
+ memset (&skill_unit_temp,0,sizeof(skill_unit_temp));
skill_unit_index=0;
}
@@ -10578,7 +10578,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
if(rand()%10000 < make_per || qty > 1){ //Success, or crafting multiple items.
struct item tmp_item;
- malloc_set(&tmp_item,0,sizeof(tmp_item));
+ memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid=nameid;
tmp_item.amount=1;
tmp_item.identify=1;
@@ -10746,7 +10746,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
pc_delitem(sd,j,1,0);
for(i=0;i<5;i++) {
- malloc_set(&tmp_item,0,sizeof(tmp_item));
+ memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.identify = 1;
tmp_item.nameid = skill_arrow_db[index].cre_id[i];
tmp_item.amount = skill_arrow_db[index].cre_amount[i];
@@ -10904,7 +10904,7 @@ void skill_init_unit_layout (void)
{
int i,j,size,pos = 0;
- malloc_set(skill_unit_layout,0,sizeof(skill_unit_layout));
+ memset(skill_unit_layout,0,sizeof(skill_unit_layout));
for (i=0; i<=MAX_SQUARE_LAYOUT; i++) {
size = i*2+1;
skill_unit_layout[i].count = size*size;
@@ -11140,7 +11140,7 @@ int skill_readdb (void)
char line[1024],path[1024],*p;
char *filename[]={"produce_db.txt","produce_db2.txt"};
- malloc_set(skill_db,0,sizeof(skill_db));
+ memset(skill_db,0,sizeof(skill_db));
sprintf(path, "%s/skill_db.txt", db_path);
fp=fopen(path,"r");
if(fp==NULL){
@@ -11299,7 +11299,7 @@ int skill_readdb (void)
while(fgets(line,1020,fp)){
char *split[50];
l++;
- malloc_tsetdword(split,0,sizeof(split)); // [Valaris] thanks to fov
+ memset(split,0,sizeof(split)); // [Valaris] thanks to fov
if(line[0]=='/' && line[1]=='/')
continue;
j = skill_split_str(line,split,6);
@@ -11384,7 +11384,7 @@ int skill_readdb (void)
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n",path);
skill_init_unit_layout();
- malloc_set(skill_produce_db,0,sizeof(skill_produce_db));
+ memset(skill_produce_db,0,sizeof(skill_produce_db));
for(m=0;m<2;m++){
sprintf(path, "%s/%s", db_path, filename[m]);
fp=fopen(path,"r");
@@ -11400,7 +11400,7 @@ int skill_readdb (void)
int x,y;
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(split,0,sizeof(split));
+ memset(split,0,sizeof(split));
j = skill_split_str(line,split,(4 + MAX_PRODUCE_RESOURCE * 2));
if(split[0]==0) //fixed by Lupus
continue;
@@ -11424,7 +11424,7 @@ int skill_readdb (void)
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",k,path);
}
- malloc_set(skill_arrow_db,0,sizeof(skill_arrow_db));
+ memset(skill_arrow_db,0,sizeof(skill_arrow_db));
sprintf(path, "%s/create_arrow_db.txt", db_path);
fp=fopen(path,"r");
@@ -11438,7 +11438,7 @@ int skill_readdb (void)
int x,y;
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(split,0,sizeof(split));
+ memset(split,0,sizeof(split));
j = skill_split_str(line,split,13);
if(split[0]==0) //fixed by Lupus
continue;
@@ -11459,7 +11459,7 @@ int skill_readdb (void)
fclose(fp);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",k,path);
- malloc_set(skill_abra_db,0,sizeof(skill_abra_db));
+ memset(skill_abra_db,0,sizeof(skill_abra_db));
sprintf(path, "%s/abra_db.txt", db_path);
fp=fopen(path,"r");
if(fp==NULL){
@@ -11471,7 +11471,7 @@ int skill_readdb (void)
char *split[16];
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(split,0,sizeof(split));
+ memset(split,0,sizeof(split));
j = skill_split_str(line,split,13);
if(split[0]==0) //fixed by Lupus
continue;
@@ -11499,7 +11499,7 @@ int skill_readdb (void)
char *split[50];
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(split,0,sizeof(split));
+ memset(split,0,sizeof(split));
j = skill_split_str(line,split,3);
if(split[0]==0) //fixed by Lupus
continue;
@@ -11528,7 +11528,7 @@ int skill_readdb (void)
char *split[16];
if(line[0]=='/' && line[1]=='/')
continue;
- malloc_tsetdword(split,0,sizeof(split));
+ memset(split,0,sizeof(split));
j = skill_split_str(line,split,2);
if(split[0]==0) //fixed by Lupus
continue;
diff --git a/src/map/status.c b/src/map/status.c
index a941d265e..a9da05e7f 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -95,8 +95,8 @@ void initChangeTables(void) {
StatusIconChangeTable[i] = SI_BLANK;
for (i = 0; i < MAX_SKILL; i++)
SkillStatusChangeTableArray[i] = -1;
- malloc_set(StatusSkillChangeTable, 0, sizeof(StatusSkillChangeTable));
- malloc_set(StatusChangeFlagTable, 0, sizeof(StatusChangeFlagTable));
+ memset(StatusSkillChangeTable, 0, sizeof(StatusSkillChangeTable));
+ memset(StatusChangeFlagTable, 0, sizeof(StatusChangeFlagTable));
//First we define the skill for common ailments. These are used in
//skill_additional_effect through sc cards. [Skotlex]
@@ -474,7 +474,7 @@ int SkillStatusChangeTable(int skill)
}
int StatusIconChangeTable[SC_MAX]; //Stores the icon that should be associated to this status change.
static void initDummyData(void) {
- malloc_set(&dummy_status, 0, sizeof(dummy_status));
+ memset(&dummy_status, 0, sizeof(dummy_status));
dummy_status.hp =
dummy_status.max_hp =
dummy_status.max_sp =
@@ -715,11 +715,11 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
{ //Reset regen ticks.
struct regen_data *regen = status_get_regen_data(target);
if (regen) {
- malloc_set(&regen->tick, 0, sizeof(regen->tick));
+ memset(&regen->tick, 0, sizeof(regen->tick));
if (regen->sregen)
- malloc_set(&regen->sregen->tick, 0, sizeof(regen->sregen->tick));
+ memset(&regen->sregen->tick, 0, sizeof(regen->sregen->tick));
if (regen->ssregen)
- malloc_set(&regen->ssregen->tick, 0, sizeof(regen->ssregen->tick));
+ memset(&regen->ssregen->tick, 0, sizeof(regen->ssregen->tick));
}
}
if(flag&4) //Delete from memory. (also invokes map removal code)
@@ -1580,7 +1580,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
// zeroed arays, order follows the order in map.h.
// add new arrays to the end of zeroed area in map.h (see comments) and size here. [zzo]
- malloc_set (sd->param_bonus, 0, sizeof(sd->param_bonus)
+ memset (sd->param_bonus, 0, sizeof(sd->param_bonus)
+ sizeof(sd->param_equip)
+ sizeof(sd->subele)
+ sizeof(sd->subrace)
@@ -1603,14 +1603,14 @@ int status_calc_pc(struct map_session_data* sd,int first)
+ sizeof(sd->sp_gain_race)
);
- malloc_set (&sd->right_weapon.overrefine, 0, sizeof(sd->right_weapon) - sizeof(sd->right_weapon.atkmods));
- malloc_set (&sd->left_weapon.overrefine, 0, sizeof(sd->left_weapon) - sizeof(sd->left_weapon.atkmods));
+ memset (&sd->right_weapon.overrefine, 0, sizeof(sd->right_weapon) - sizeof(sd->right_weapon.atkmods));
+ memset (&sd->left_weapon.overrefine, 0, sizeof(sd->left_weapon) - sizeof(sd->left_weapon.atkmods));
- malloc_set(&sd->special_state,0,sizeof(sd->special_state));
- malloc_set(&status->max_hp, 0, sizeof(struct status_data)-(sizeof(status->hp)+sizeof(status->sp)+sizeof(status->lhw)));
- malloc_set(status->lhw, 0, sizeof(struct weapon_atk));
+ memset(&sd->special_state,0,sizeof(sd->special_state));
+ memset(&status->max_hp, 0, sizeof(struct status_data)-(sizeof(status->hp)+sizeof(status->sp)+sizeof(status->lhw)));
+ memset(status->lhw, 0, sizeof(struct weapon_atk));
- //FIXME: Most of these stuff should be calculated once, but how do I fix the malloc_set above to do that? [Skotlex]
+ //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex]
status->speed = DEFAULT_WALK_SPEED;
//Give them all modes except these (useful for clones)
status->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY);
@@ -1629,7 +1629,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
status->race = RC_DEMIHUMAN;
//zero up structures...
- malloc_set(&sd->autospell,0,sizeof(sd->autospell)
+ memset(&sd->autospell,0,sizeof(sd->autospell)
+ sizeof(sd->autospell2)
+ sizeof(sd->addeff)
+ sizeof(sd->addeff2)
@@ -1644,7 +1644,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
);
// vars zeroing. ints, shorts, chars. in that order.
- malloc_set (&sd->arrow_atk, 0,sizeof(sd->arrow_atk)
+ memset (&sd->arrow_atk, 0,sizeof(sd->arrow_atk)
+ sizeof(sd->arrow_ele)
+ sizeof(sd->arrow_cri)
+ sizeof(sd->arrow_hit)
@@ -1789,7 +1789,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
//Store equipment script bonuses
memcpy(sd->param_equip,sd->param_bonus,sizeof(sd->param_equip));
- malloc_set(sd->param_bonus, 0, sizeof(sd->param_bonus));
+ memset(sd->param_bonus, 0, sizeof(sd->param_bonus));
status->def += (refinedef+50)/100;
@@ -4337,7 +4337,7 @@ void status_change_init(struct block_list *bl)
struct status_change *sc = status_get_sc(bl);
int i;
nullpo_retv(sc);
- malloc_set(sc, 0, sizeof (struct status_change));
+ memset(sc, 0, sizeof (struct status_change));
for (i=0; i< SC_MAX; i++)
sc->data[i].timer = -1;
}
@@ -7211,7 +7211,7 @@ static int status_calc_sigma(void)
unsigned int k;
for(i=0;i<MAX_PC_CLASS;i++) {
- malloc_tsetdword(hp_sigma_val[i],0,sizeof(hp_sigma_val[i]));
+ memset(hp_sigma_val[i],0,sizeof(hp_sigma_val[i]));
for(k=0,j=2;j<=MAX_LEVEL;j++) {
k += hp_coefficient[i]*j + 50;
k -= k%100;
@@ -7265,7 +7265,7 @@ int status_readdb(void) {
fclose(fp);
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n",path);
- malloc_tsetdword(job_bonus,0,sizeof(job_bonus)); // Job-specific stats bonus
+ memset(job_bonus,0,sizeof(job_bonus)); // Job-specific stats bonus
sprintf(path, "%s/job_db2.txt", db_path);
fp=fopen(path,"r");
if(fp==NULL){
@@ -7306,7 +7306,7 @@ int status_readdb(void) {
continue;
if(atoi(line)<=0)
continue;
- malloc_tsetdword(split,0,sizeof(split));
+ memset(split,0,sizeof(split));
for(j=0,p=line;j<MAX_WEAPON_TYPE && p;j++){
split[j]=p;
p=strchr(p,',');
@@ -7341,7 +7341,7 @@ int status_readdb(void) {
continue;
if(atoi(line)<=0)
continue;
- malloc_tsetdword(split,0,sizeof(split));
+ memset(split,0,sizeof(split));
for(j=0,p=line;j<MAX_REFINE+4 && p;j++){
split[j]=p;
p=strchr(p,',');
diff --git a/src/map/storage.c b/src/map/storage.c
index ba44f0f0d..529f2acde 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -218,7 +218,7 @@ static int storage_delitem(struct map_session_data *sd,struct storage *stor,int
stor->storage_[n].amount-=amount;
if(stor->storage_[n].amount==0){
- malloc_set(&stor->storage_[n],0,sizeof(stor->storage_[0]));
+ memset(&stor->storage_[n],0,sizeof(stor->storage_[0]));
stor->storage_amount--;
clif_updatestorageamount(sd,stor);
}
@@ -566,7 +566,7 @@ int guild_storage_delitem(struct map_session_data *sd,struct guild_storage *stor
stor->storage_[n].amount-=amount;
if(stor->storage_[n].amount==0){
- malloc_set(&stor->storage_[n],0,sizeof(stor->storage_[0]));
+ memset(&stor->storage_[n],0,sizeof(stor->storage_[0]));
stor->storage_amount--;
clif_updateguildstorageamount(sd,stor);
}
diff --git a/src/map/trade.c b/src/map/trade.c
index 36c6d43f4..63df19940 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -140,8 +140,8 @@ void trade_tradeack(struct map_session_data *sd, int type) {
//Initiate trade
sd->state.trading = 1;
tsd->state.trading = 1;
- malloc_set(&sd->deal, 0, sizeof(sd->deal));
- malloc_set(&tsd->deal, 0, sizeof(tsd->deal));
+ memset(&sd->deal, 0, sizeof(sd->deal));
+ memset(&tsd->deal, 0, sizeof(tsd->deal));
clif_tradestart(tsd, type);
clif_tradestart(sd, type);
}
@@ -173,7 +173,7 @@ int impossible_trade_check(struct map_session_data *sd) {
// remove equiped items (they can not be trade)
for (i = 0; i < MAX_INVENTORY; i++)
if (inventory[i].nameid > 0 && inventory[i].equip && !(inventory[i].equip & EQP_AMMO))
- malloc_set(&inventory[i], 0, sizeof(struct item));
+ memset(&inventory[i], 0, sizeof(struct item));
// check items in player inventory
for(i = 0; i < 10; i++) {
diff --git a/src/map/unit.c b/src/map/unit.c
index 21175cc30..8684c0732 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1473,7 +1473,7 @@ void unit_dataset(struct block_list *bl) {
struct unit_data *ud;
nullpo_retv(ud = unit_bl2ud(bl));
- malloc_set( ud, 0, sizeof( struct unit_data) );
+ memset( ud, 0, sizeof( struct unit_data) );
ud->bl = bl;
ud->walktimer = -1;
ud->skilltimer = -1;