#define save_sptr Perl_save_sptr
#define save_svref Perl_save_svref
#define save_pushptr Perl_save_pushptr
+#if defined(PERL_IN_SCOPE_C)
+#ifdef PERL_CORE
+#define save_pushptrptr S_save_pushptrptr
+#endif
+#endif
#ifdef PERL_CORE
#define sawparens Perl_sawparens
#define scalar Perl_scalar
#define save_sptr(a) Perl_save_sptr(aTHX_ a)
#define save_svref(a) Perl_save_svref(aTHX_ a)
#define save_pushptr(a,b) Perl_save_pushptr(aTHX_ a,b)
+#if defined(PERL_IN_SCOPE_C)
+#ifdef PERL_CORE
+#define save_pushptrptr(a,b,c) S_save_pushptrptr(aTHX_ a,b,c)
+#endif
+#endif
#ifdef PERL_CORE
#define sawparens(a) Perl_sawparens(aTHX_ a)
#define scalar(a) Perl_scalar(aTHX_ a)
return sv;
}
+static void
+S_save_pushptrptr(pTHX_ void *const ptr1, void *const ptr2, const int type)
+{
+ dVAR;
+ SSCHECK(3);
+ SSPUSHPTR(ptr1);
+ SSPUSHPTR(ptr2);
+ SSPUSHINT(type);
+}
+
SV *
Perl_save_scalar(pTHX_ GV *gv)
{
PL_localizing = 1;
SvGETMAGIC(*sptr);
PL_localizing = 0;
- SSCHECK(3);
- SSPUSHPTR(SvREFCNT_inc_simple(gv));
- SSPUSHPTR(SvREFCNT_inc(*sptr));
- SSPUSHINT(SAVEt_SV);
+ save_pushptrptr(SvREFCNT_inc_simple(gv), SvREFCNT_inc(*sptr), SAVEt_SV);
return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
}
PERL_ARGS_ASSERT_SAVE_GENERIC_SVREF;
- SSCHECK(3);
- SSPUSHPTR(sptr);
- SSPUSHPTR(SvREFCNT_inc(*sptr));
- SSPUSHINT(SAVEt_GENERIC_SVREF);
+ save_pushptrptr(sptr, SvREFCNT_inc(*sptr), SAVEt_GENERIC_SVREF);
}
/* Like save_pptr(), but also Safefree()s the new value if it is different
PERL_ARGS_ASSERT_SAVE_GENERIC_PVREF;
- SSCHECK(3);
- SSPUSHPTR(*str);
- SSPUSHPTR(str);
- SSPUSHINT(SAVEt_GENERIC_PVREF);
+ save_pushptrptr(*str, str, SAVEt_GENERIC_PVREF);
}
/* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree().
PERL_ARGS_ASSERT_SAVE_SHARED_PVREF;
- SSCHECK(3);
- SSPUSHPTR(str);
- SSPUSHPTR(*str);
- SSPUSHINT(SAVEt_SHARED_PVREF);
+ save_pushptrptr(str, *str, SAVEt_SHARED_PVREF);
}
/* set the SvFLAGS specified by mask to the values in val */
PERL_ARGS_ASSERT_SAVE_GP;
- SSGROW(3);
- SSPUSHPTR(SvREFCNT_inc(gv));
- SSPUSHPTR(GvGP(gv));
- SSPUSHINT(SAVEt_GP);
+ save_pushptrptr(SvREFCNT_inc(gv), GvGP(gv), SAVEt_GP);
if (empty) {
GP *gp = Perl_newGP(aTHX_ gv);
if (!AvREAL(oav) && AvREIFY(oav))
av_reify(oav);
- SSCHECK(3);
- SSPUSHPTR(gv);
- SSPUSHPTR(oav);
- SSPUSHINT(SAVEt_AV);
+ save_pushptrptr(gv, oav, SAVEt_AV);
GvAV(gv) = NULL;
av = GvAVn(gv);
PERL_ARGS_ASSERT_SAVE_HASH;
- SSCHECK(3);
- SSPUSHPTR(gv);
- SSPUSHPTR(ohv = GvHVn(gv));
- SSPUSHINT(SAVEt_HV);
+ save_pushptrptr(gv, (ohv = GvHVn(gv)), SAVEt_HV);
GvHV(gv) = NULL;
hv = GvHVn(gv);
PERL_ARGS_ASSERT_SAVE_ITEM;
- SSCHECK(3);
- SSPUSHPTR(item); /* remember the pointer */
- SSPUSHPTR(sv); /* remember the value */
- SSPUSHINT(SAVEt_ITEM);
+ save_pushptrptr(item, /* remember the pointer */
+ sv, /* remember the value */
+ SAVEt_ITEM);
}
void
PERL_ARGS_ASSERT_SAVE_PPTR;
- SSCHECK(3);
- SSPUSHPTR(*pptr);
- SSPUSHPTR(pptr);
- SSPUSHINT(SAVEt_PPTR);
+ save_pushptrptr(*pptr, pptr, SAVEt_PPTR);
}
void
PERL_ARGS_ASSERT_SAVE_VPTR;
- SSCHECK(3);
- SSPUSHPTR(*(char**)ptr);
- SSPUSHPTR(ptr);
- SSPUSHINT(SAVEt_VPTR);
+ save_pushptrptr(*(char**)ptr, ptr, SAVEt_VPTR);
}
void
PERL_ARGS_ASSERT_SAVE_SPTR;
- SSCHECK(3);
- SSPUSHPTR(*sptr);
- SSPUSHPTR(sptr);
- SSPUSHINT(SAVEt_SPTR);
+ save_pushptrptr(*sptr, sptr, SAVEt_SPTR);
}
void
PERL_ARGS_ASSERT_SAVE_HPTR;
- SSCHECK(3);
- SSPUSHPTR(*hptr);
- SSPUSHPTR(hptr);
- SSPUSHINT(SAVEt_HPTR);
+ save_pushptrptr(*hptr, hptr, SAVEt_HPTR);
}
void
PERL_ARGS_ASSERT_SAVE_APTR;
- SSCHECK(3);
- SSPUSHPTR(*aptr);
- SSPUSHPTR(aptr);
- SSPUSHINT(SAVEt_APTR);
+ save_pushptrptr(*aptr, aptr, SAVEt_APTR);
}
void
PERL_ARGS_ASSERT_SAVE_SVREF;
SvGETMAGIC(*sptr);
- SSCHECK(3);
- SSPUSHPTR(sptr);
- SSPUSHPTR(SvREFCNT_inc(*sptr));
- SSPUSHINT(SAVEt_SVREF);
+ save_pushptrptr(sptr, SvREFCNT_inc(*sptr), SAVEt_SVREF);
return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
}