diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-02-12 13:15:20 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-02-12 13:15:20 +0000 |
commit | 7918f24d20384771923d344a382e1d16d9552018 (patch) | |
tree | 627e24f3c520f70ddfd3fc9779420bd72fd00c55 /mro.c | |
parent | 9f10164a6c9d93684fedbbc188fb9dfe004c22c4 (diff) | |
download | perl-7918f24d20384771923d344a382e1d16d9552018.tar.gz |
assert() that every NN argument is not NULL. Otherwise we have the
ability to create landmines that will explode under someone in the
future when they upgrade their compiler to one with better
optimisation. We've already done this at least twice.
(Yes, some of the assertions are after code that would already have
SEGVd because it already deferences a pointer, but they are put in
to make it easier to automate checking that each and every case is
covered.)
Add a tool, checkARGS_ASSERT.pl, to check that every case is covered.
p4raw-id: //depot/perl@33291
Diffstat (limited to 'mro.c')
-rw-r--r-- | mro.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -54,7 +54,7 @@ Perl_mro_meta_init(pTHX_ HV* stash) { struct mro_meta* newmeta; - assert(stash); + PERL_ARGS_ASSERT_MRO_META_INIT; assert(HvAUX(stash)); assert(!(HvAUX(stash)->xhv_mro_meta)); Newxz(newmeta, 1, struct mro_meta); @@ -74,7 +74,7 @@ Perl_mro_meta_dup(pTHX_ struct mro_meta* smeta, CLONE_PARAMS* param) { struct mro_meta* newmeta; - assert(smeta); + PERL_ARGS_ASSERT_MRO_META_DUP; Newx(newmeta, 1, struct mro_meta); Copy(smeta, newmeta, 1, struct mro_meta); @@ -120,7 +120,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, I32 level) const HEK* stashhek; struct mro_meta* meta; - assert(stash); + PERL_ARGS_ASSERT_MRO_GET_LINEAR_ISA_DFS; assert(HvAUX(stash)); stashhek = HvNAME_HEK(stash); @@ -234,7 +234,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level) const HEK* stashhek; struct mro_meta* meta; - assert(stash); + PERL_ARGS_ASSERT_MRO_GET_LINEAR_ISA_C3; assert(HvAUX(stash)); stashhek = HvNAME_HEK(stash); @@ -447,7 +447,7 @@ Perl_mro_get_linear_isa(pTHX_ HV *stash) { struct mro_meta* meta; - assert(stash); + PERL_ARGS_ASSERT_MRO_GET_LINEAR_ISA; if(!SvOOK(stash)) Perl_croak(aTHX_ "Can't linearize anonymous symbol table"); @@ -481,6 +481,8 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) const char * const stashname = HvNAME_get(stash); const STRLEN stashname_len = HvNAMELEN_get(stash); + PERL_ARGS_ASSERT_MRO_ISA_CHANGED_IN; + if(!stashname) Perl_croak(aTHX_ "Can't call mro_isa_changed_in() on anonymous symbol table"); @@ -618,6 +620,8 @@ Perl_mro_method_changed_in(pTHX_ HV *stash) SV ** const svp = hv_fetch(PL_isarev, stashname, stashname_len, 0); HV * const isarev = svp ? (HV*)*svp : NULL; + PERL_ARGS_ASSERT_MRO_METHOD_CHANGED_IN; + if(!stashname) Perl_croak(aTHX_ "Can't call mro_method_changed_in() on anonymous symbol table"); |