X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Magic.xs;h=735683c600e192599122ac3d8785809a5fcb68d4;hb=ace906d7e76ed647adbd1ab1243ac9bdbde9b1d5;hp=3ec0b6fed0db8342fc010d9d91d51631bbbce645;hpb=4d18d9fb3cb2ad7da53f58a9b0741ba6cb97ec62;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/Magic.xs b/Magic.xs index 3ec0b6f..735683c 100644 --- a/Magic.xs +++ b/Magic.xs @@ -104,6 +104,10 @@ STATIC SV *vmg_clone(pTHX_ SV *sv, tTHX owner) { # define SvRV_const(sv) SvRV((SV *) sv) #endif +#ifndef SvREFCNT_inc_simple_void +# define SvREFCNT_inc_simple_void(sv) SvREFCNT_inc(sv) +#endif + #ifndef mPUSHu # define mPUSHu(U) PUSHs(sv_2mortal(newSVuv(U))) #endif @@ -633,9 +637,9 @@ STATIC SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, SV **args, I32 items) { SPAGAIN; nsv = POPs; #if VMG_HAS_PERL(5, 8, 3) - SvREFCNT_inc(nsv); /* Or it will be destroyed in FREETMPS */ + SvREFCNT_inc_simple_void(nsv); /* Or it will be destroyed in FREETMPS */ #else - nsv = sv_newref(nsv); /* Workaround some bug in SvREFCNT_inc() */ + nsv = sv_newref(nsv); /* Workaround some bug in SvREFCNT_inc() */ #endif PUTBACK; @@ -1018,7 +1022,7 @@ STATIC U32 vmg_svt_len(pTHX_ SV *sv, MAGIC *mg) { svr = POPs; ret = SvOK(svr) ? (U32) SvUV(svr) : len; if (t == SVt_PVAV) - --ret; + --ret; PUTBACK; FREETMPS; @@ -1052,7 +1056,7 @@ STATIC int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) { w = vmg_wizard_mgwiz(mg->mg_ptr); /* So that it survives the temp cleanup below */ - SvREFCNT_inc(sv); + SvREFCNT_inc_simple_void(sv); #if !VMG_HAS_PERL_MAINT(5, 11, 0, 32686) /* The previous magic tokens were freed but the magic chain wasn't updated, so @@ -1094,8 +1098,16 @@ STATIC int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) { #endif has_err = SvTRUE(ERRSV); - if (IN_PERL_COMPILETIME && !had_err && has_err) - ++PL_error_count; + if (IN_PERL_COMPILETIME && !had_err && has_err) { + if (PL_errors) + sv_catsv(PL_errors, ERRSV); + else + Perl_warn(aTHX_ "%s", SvPV_nolen(ERRSV)); +#ifdef PL_parser + if (PL_parser) +#endif + ++PL_error_count; + } SPAGAIN; svr = POPs;