summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-12-13 16:28:22 +0100
committerHaru <haru@dotalux.com>2013-12-17 01:02:32 +0100
commit853c5a3141d1f431af95aed55d991334a2b995f6 (patch)
tree09ce65b20320045954be0b3582e38fb7d01fef0b /src/map
parentefe4174e59dc462130fde872365e891a7c73654a (diff)
downloadhercules-853c5a3141d1f431af95aed55d991334a2b995f6.tar.gz
hercules-853c5a3141d1f431af95aed55d991334a2b995f6.tar.bz2
hercules-853c5a3141d1f431af95aed55d991334a2b995f6.tar.xz
hercules-853c5a3141d1f431af95aed55d991334a2b995f6.zip
Nullpo cleanup
- Removed unused, nonportable nullpo checks with formatted message (related: eAthena r15245) - Converted nullpo_chk to a macro, to make it easier on the llvm static analyzer. - Added more details to the nullpo_info reports (related: eAthena r15246) - Ensured that the nullpo check macros evaluate their pointer argument once and only once, so that it's safe to use with expressions that assign values or have side-effects. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index b3e7e6dc2..94c8fe581 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3209,11 +3209,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
memset(&ad,0,sizeof(ad));
memset(&flag,0,sizeof(flag));
- if(src==NULL || target==NULL)
- {
- nullpo_info(NLP_MARK);
- return ad;
- }
+ nullpo_retr(ad, src);
+ nullpo_retr(ad, target);
+
//Initial Values
ad.damage = 1;
ad.div_=skill->get_num(skill_id,skill_lv);
@@ -3521,10 +3519,8 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
memset(&md,0,sizeof(md));
- if( src == NULL || target == NULL ){
- nullpo_info(NLP_MARK);
- return md;
- }
+ nullpo_retr(md, src);
+ nullpo_retr(md, target);
//Some initial values
md.amotion=skill->get_inf(skill_id)&INF_GROUND_SKILL?0:sstatus->amotion;
@@ -3947,11 +3943,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
memset(&wd,0,sizeof(wd));
memset(&flag,0,sizeof(flag));
- if(src==NULL || target==NULL)
- {
- nullpo_info(NLP_MARK);
- return wd;
- }
+ nullpo_retr(wd, src);
+ nullpo_retr(wd, target);
+
//Initial flag
flag.rh=1;
flag.weapon=1;