summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-29 04:00:19 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-29 04:00:19 +0000
commit4db583138b9556f72b13df7f66eeeace6a67ce3e (patch)
tree72b6589e9f7a0e46e2aa459cd6272bb90bfe7e96 /src/map/skill.c
parent525aa7d56ec5d74eac548d948782330d02df8f3e (diff)
downloadhercules-4db583138b9556f72b13df7f66eeeace6a67ce3e.tar.gz
hercules-4db583138b9556f72b13df7f66eeeace6a67ce3e.tar.bz2
hercules-4db583138b9556f72b13df7f66eeeace6a67ce3e.tar.xz
hercules-4db583138b9556f72b13df7f66eeeace6a67ce3e.zip
* Using malloc for memory allocations that doesn't need to be pre-initialized.
* Eliminated initializations for pointers returned by calloc. * Moved grfio_final to do_init since it's not used after server boot. * Optimized scripts to return CONSTSTR instead of allocating memory just to return a constant string. Some buildin functions still need work. * Disabled graph since it doesn't work yet. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6355 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 21140d8c0..d70e6c262 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -6499,12 +6499,13 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
group->bl_flag= skill_get_unit_bl_target(skillid);
if(skillid==HT_TALKIEBOX ||
skillid==RG_GRAFFITI){
- group->valstr=(char *) aCallocA(MESSAGE_SIZE, sizeof(char));
+ group->valstr=(char *) aMallocA(MESSAGE_SIZE*sizeof(char));
if(group->valstr==NULL){
ShowFatalError("skill_castend_map: out of memory !\n");
exit(1);
}
memcpy(group->valstr,talkie_mes,MESSAGE_SIZE-1);
+ group->valstr[MESSAGE_SIZE-1] = '\0';
}
//Why redefine local variables when the ones of the function can be reused? [Skotlex]
@@ -9374,9 +9375,9 @@ struct skill_unit_group *skill_initunitgroup(struct block_list *src,
group->group_id=skill_unit_group_newid++;
if(skill_unit_group_newid<=0)
skill_unit_group_newid = MAX_SKILL_DB;
- group->unit=(struct skill_unit *)aCalloc(count,sizeof(struct skill_unit));
+ group->unit=(struct skill_unit *)aMalloc(count*sizeof(struct skill_unit));
group->unit_count=count;
- group->val1=group->val2=0;
+ group->val1=group->val2=group->val3=0;
group->skill_id=skillid;
group->skill_lv=skilllv;
group->unit_id=unit_id;