]> git.vpit.fr Git - perl/modules/Variable-Magic.git/commitdiff
Improve logic for the SvREFCNT_inc workaround in vmg_data_new(). Also, enable it...
authorVincent Pit <vince@profvince.com>
Wed, 12 Nov 2008 19:07:57 +0000 (20:07 +0100)
committerVincent Pit <vince@profvince.com>
Wed, 12 Nov 2008 19:07:57 +0000 (20:07 +0100)
Magic.xs

index 72e6477037ca51ca16bb4854ce455112ebe51d2e..35084d235dbb3f4cb0944d87a7687babc6b9914f 100644 (file)
--- 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;