diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/map/script.c b/src/map/script.c index 90723cc60..419ea5969 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -307,12 +307,12 @@ int add_str(const unsigned char *p) if(str_num>=str_data_size){ str_data_size+=128; str_data=aRealloc(str_data,sizeof(str_data[0])*str_data_size); - memset(str_data + (str_data_size - 128), '\0', 128); + malloc_tsetdword(str_data + (str_data_size - 128), '\0', 128); } while(str_pos+(int)strlen((char *) p)+1>=str_size){ str_size+=256; str_buf=(char *)aRealloc(str_buf,str_size); - memset(str_buf + (str_size - 256), '\0', 256); + malloc_tsetdword(str_buf + (str_size - 256), '\0', 256); } strcpy(str_buf+str_pos, (char *) p); str_data[str_num].type=C_NOP; @@ -335,7 +335,7 @@ static void check_script_buf(int size) if(script_pos+size>=script_size){ script_size+=SCRIPT_BLOCK_SIZE; script_buf=(unsigned char *)aRealloc(script_buf,script_size); - memset(script_buf + script_size - SCRIPT_BLOCK_SIZE, '\0', + malloc_tsetdword(script_buf + script_size - SCRIPT_BLOCK_SIZE, '\0', SCRIPT_BLOCK_SIZE); } } @@ -1575,7 +1575,7 @@ struct script_code* parse_script(unsigned char *src,const char *file,int line) struct script_code *code; static int first=1; - memset(&syntax,0,sizeof(syntax)); + malloc_set(&syntax,0,sizeof(syntax)); if(first){ add_buildin_func(); read_constdb(); @@ -1967,7 +1967,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); - memset(stack->stack_data + (stack->sp_max - 64), 0, + malloc_tsetdword(stack->stack_data + (stack->sp_max - 64), 0, 64 * sizeof(*(stack->stack_data))); } // if(battle_config.etc_log) @@ -1998,7 +1998,7 @@ void push_str(struct script_stack *stack,int type,unsigned char *str) stack->sp_max += 64; stack->stack_data = (struct script_data *)aRealloc(stack->stack_data, sizeof(stack->stack_data[0]) * stack->sp_max); - memset(stack->stack_data + (stack->sp_max - 64), '\0', + malloc_tsetdword(stack->stack_data + (stack->sp_max - 64), '\0', 64 * sizeof(*(stack->stack_data))); } // if(battle_config.etc_log) @@ -3149,7 +3149,7 @@ int script_config_read_sub(char *cfgName) int script_config_read(char *cfgName) { //Script related variables should be initialized once! [Skotlex] - memset (&script_config, 0, sizeof(script_config)); + malloc_set (&script_config, 0, sizeof(script_config)); script_config.verbose_mode = 0; script_config.warn_func_no_comma = 1; script_config.warn_cmd_no_comma = 1; @@ -5136,7 +5136,7 @@ int buildin_getitem(struct script_state *st) return 1; //No item created. } - memset(&item_tmp,0,sizeof(item_tmp)); + malloc_set(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid=nameid; if(!flag) item_tmp.identify=1; @@ -5207,7 +5207,7 @@ int buildin_getitem2(struct script_state *st) } if(nameid > 0) { - memset(&item_tmp,0,sizeof(item_tmp)); + malloc_set(&item_tmp,0,sizeof(item_tmp)); item_data=itemdb_exists(nameid); if (item_data == NULL) return -1; @@ -5301,7 +5301,7 @@ int buildin_getnameditem(struct script_state *st) return 0; } - memset(&item_tmp,0,sizeof(item_tmp)); + malloc_set(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid=nameid; item_tmp.amount=1; item_tmp.identify=1; @@ -5378,7 +5378,7 @@ int buildin_makeitem(struct script_state *st) } if(nameid > 0) { - memset(&item_tmp,0,sizeof(item_tmp)); + malloc_set(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid=nameid; if(!flag) item_tmp.identify=1; @@ -10023,7 +10023,7 @@ int buildin_atcommand(struct script_state *st) else { //Use a dummy character. struct map_session_data dummy_sd; struct block_list *bl = NULL; - memset(&dummy_sd, 0, sizeof(struct map_session_data)); + malloc_set(&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)); @@ -10050,7 +10050,7 @@ int buildin_charcommand(struct script_state *st) else { //Use a dummy character. struct map_session_data dummy_sd; struct block_list *bl = NULL; - memset(&dummy_sd, 0, sizeof(struct map_session_data)); + malloc_set(&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)); @@ -10528,7 +10528,7 @@ int buildin_getmapxy(struct script_state *st){ int x,y,type; char mapname[MAP_NAME_LENGTH+1]; - memset(mapname, 0, sizeof(mapname)); + malloc_set(mapname, 0, sizeof(mapname)); if( st->stack->stack_data[st->start+2].type!=C_NAME ){ ShowWarning("script: buildin_getmapxy: not mapname variable\n"); @@ -11253,7 +11253,7 @@ int buildin_query_sql(struct script_state *st) { return 1; } - memset(row, 0, sizeof(row)); + malloc_set(row, 0, sizeof(row)); // Verify argument types for(j=0; j < nb_rows; j++) { @@ -11429,7 +11429,7 @@ int buildin_npcshopitem(struct script_state *st) sizeof(nd->u.shop_item[0]) * amount); // Reset sell list. - memset(nd->u.shop_item, 0, sizeof(nd->u.shop_item[0]) * amount); + malloc_set(nd->u.shop_item, 0, sizeof(nd->u.shop_item[0]) * amount); n = 0; |