From: Vincent Pit Date: Wed, 12 Nov 2008 19:07:57 +0000 (+0100) Subject: Improve logic for the SvREFCNT_inc workaround in vmg_data_new(). Also, enable it... X-Git-Tag: v0.25~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=6283e66e99181bb1101fffc53da93f81bfe32352;p=perl%2Fmodules%2FVariable-Magic.git Improve logic for the SvREFCNT_inc workaround in vmg_data_new(). Also, enable it up to 5.8.3 included, as it was before the previous macro overhaul --- diff --git a/Magic.xs b/Magic.xs index 72e6477..35084d2 100644 --- a/Magic.xs +++ b/Magic.xs @@ -248,10 +248,10 @@ STATIC SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, AV *args) { if (count != 1) { croak("Callback needs to return 1 scalar\n"); } nsv = POPs; -#if !VMG_HAS_PERL(5, 8, 2) - nsv = sv_newref(nsv); /* Workaround some bug in SvREFCNT_inc() */ -#else +#if VMG_HAS_PERL(5, 8, 3) SvREFCNT_inc(nsv); /* Or it will be destroyed in FREETMPS */ +#else + nsv = sv_newref(nsv); /* Workaround some bug in SvREFCNT_inc() */ #endif PUTBACK;