]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - Magic.xs
base.pm is also a dependency
[perl/modules/Variable-Magic.git] / Magic.xs
index c925143a4eb8979ac0f225e14a1363ef67f392e9..77b620999cf2a964ad1be719a2f49590701e30ba 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
@@ -135,8 +135,9 @@ STATIC SV *vmg_clone(pTHX_ SV *sv, tTHX owner) {
 # endif
 #endif
 
-/* uvar magic and Hash::Util::FieldHash were commited with 28419 */
-#if VMG_HAS_PERL_MAINT(5, 9, 4, 28419) || VMG_HAS_PERL(5, 10, 0)
+/* uvar magic and Hash::Util::FieldHash were commited with 28419, but only
+ * enable it on 5.10 */
+#if VMG_HAS_PERL(5, 10, 0)
 # define VMG_UVAR 1
 #else
 # define VMG_UVAR 0
@@ -812,8 +813,9 @@ STATIC int vmg_svt_clear(pTHX_ SV *sv, MAGIC *mg) {
 
 STATIC int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) {
  const MGWIZ *w;
-#if VMG_HAS_PERL(5, 10, 0)
+#if VMG_HAS_PERL(5, 9, 5)
  PERL_CONTEXT saved_cx;
+ I32 cxix;
 #endif
  unsigned int had_err, has_err, flags = G_SCALAR | G_EVAL;
  int ret = 0;
@@ -852,19 +854,21 @@ STATIC int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) {
  if (had_err)
   flags |= G_KEEPERR;
 
-#if VMG_HAS_PERL(5, 10, 0)
+#if VMG_HAS_PERL(5, 9, 5)
  /* This context should not be used anymore, but since we croak in places the
   * core doesn't even dare to, some pointers to it may remain in the upper call
   * stack. Make sure call_sv() doesn't clobber it. */
- if (cxstack_ix >= cxstack_max)
-  Perl_cxinc(aTHX);
- saved_cx = cxstack[cxstack_ix + 1];
+ if (cxstack_ix < cxstack_max)
+  cxix = cxstack_ix + 1;
+ else
+  cxix = Perl_cxinc(aTHX);
+ saved_cx = cxstack[cxix];
 #endif
 
  call_sv(w->cb_free, flags);
 
-#if VMG_HAS_PERL(5, 10, 0)
- cxstack[cxstack_ix + 1] = saved_cx;
+#if VMG_HAS_PERL(5, 9, 5)
+ cxstack[cxix] = saved_cx;
 #endif
 
  has_err = SvTRUE(ERRSV);
@@ -1464,7 +1468,7 @@ PPCODE:
  sig  = vmg_wizard_sig(wiz);
  data = vmg_data_get(SvRV(sv), sig);
  if (!data)
-  XSRETURN_UNDEF;
+  XSRETURN_EMPTY;
  ST(0) = data;
  XSRETURN(1);