X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=autovivification.xs;h=222b3a7cae06375674841d622273d5091f0e39e1;hb=cfd4bbeefd3356b9728b9d71ac50d6cf80375812;hp=43922752149c3457518c1b0f65f8fc8c211e9c81;hpb=aebbab9a783906dacf7815fec6b1da3f17ed3aca;p=perl%2Fmodules%2Fautovivification.git diff --git a/autovivification.xs b/autovivification.xs index 4392275..222b3a7 100644 --- a/autovivification.xs +++ b/autovivification.xs @@ -49,12 +49,17 @@ #endif #ifndef A_MULTIPLICITY -# if defined(MULTIPLICITY) || defined(PERL_IMPLICIT_CONTEXT) +# if defined(MULTIPLICITY) # define A_MULTIPLICITY 1 # else # define A_MULTIPLICITY 0 # endif #endif +#if A_MULTIPLICITY +# ifndef PERL_IMPLICIT_CONTEXT +# error MULTIPLICITY builds must set PERL_IMPLICIT_CONTEXT +# endif +#endif #ifndef tTHX # define tTHX PerlInterpreter* @@ -710,6 +715,16 @@ static OP *a_pp_rv2hv(pTHX) { /* ... pp_deref (aelem,helem,rv2sv,padsv) .................................. */ +static void a_cannot_vivify(pTHX_ UV flags) { +#define a_cannot_vivify(F) a_cannot_vivify(aTHX_ (F)) + if (flags & A_HINT_STRICT) + croak("Reference vivification forbidden"); + else if (flags & A_HINT_WARN) + warn("Reference was vivified"); + else /* A_HINT_STORE */ + croak("Can't vivify reference"); +} + static OP *a_pp_deref(pTHX) { dA_MAP_THX; const a_op_info *oi; @@ -726,14 +741,8 @@ static OP *a_pp_deref(pTHX) { if (flags & (A_HINT_NOTIFY|A_HINT_STORE)) { SPAGAIN; - if (a_undef(TOPs)) { - if (flags & A_HINT_STRICT) - croak("Reference vivification forbidden"); - else if (flags & A_HINT_WARN) - warn("Reference was vivified"); - else /* A_HINT_STORE */ - croak("Can't vivify reference"); - } + if (a_undef(TOPs)) + a_cannot_vivify(flags); } return o;