summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2008-01-04 01:06:10 +0000
committerMarcus Holland-Moritz <mhx-perl@gmx.net>2008-01-04 01:06:10 +0000
commit6e449a3ab1e3bd9d7e138ca681c733e57d4daa49 (patch)
treead260a44d03e2cd4466a3495bd249239dc834046 /pp.h
parentad25789c15269a04312e0efede81842547aa8212 (diff)
downloadperl-6e449a3ab1e3bd9d7e138ca681c733e57d4daa49.tar.gz
Add macros mPUSHs() and mXPUSHs() for pushing SVs on the stack
and mortalizing them. Use these macros where possible. And also mX?PUSH[inpu] where possible. p4raw-id: //depot/perl@32821
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/pp.h b/pp.h
index 9abd962b84..c2cf6914ea 100644
--- a/pp.h
+++ b/pp.h
@@ -224,6 +224,11 @@ called to declare it. Do not call multiple C<TARG>-oriented macros to
return lists from XSUB's - see C<mXPUSHu> instead. See also C<PUSHu> and
C<mPUSHu>.
+=for apidoc Am|void|mPUSHs|SV* sv
+Push an SV onto the stack and mortalizes the SV. The stack must have room
+for this element. Does not handle 'set' magic. Does not use C<TARG>.
+See also C<PUSHs> and C<mXPUSHs>.
+
=for apidoc Am|void|PUSHmortal
Push a new mortal SV onto the stack. The stack must have room for this
element. Does not handle 'set' magic. Does not use C<TARG>. See also
@@ -249,6 +254,11 @@ Push an unsigned integer onto the stack. The stack must have room for this
element. Handles 'set' magic. Does not use C<TARG>. See also C<PUSHu>,
C<mXPUSHu> and C<XPUSHu>.
+=for apidoc Am|void|mXPUSHs|SV* sv
+Push an SV onto the stack, extending the stack if necessary and mortalizes
+the SV. Does not handle 'set' magic. Does not use C<TARG>. See also
+C<XPUSHs> and C<mPUSHs>.
+
=for apidoc Am|void|XPUSHmortal
Push a new mortal SV onto the stack, extending the stack if necessary. Does
not handle 'set' magic. Does not use C<TARG>. See also C<XPUSHs>,
@@ -303,12 +313,14 @@ and C<PUSHu>.
#define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
#define XPUSHundef STMT_START { SvOK_off(TARG); XPUSHs(TARG); } STMT_END
+#define mPUSHs(s) PUSHs(sv_2mortal(s))
#define PUSHmortal PUSHs(sv_newmortal())
#define mPUSHp(p,l) sv_setpvn_mg(PUSHmortal, (p), (l))
#define mPUSHn(n) sv_setnv_mg(PUSHmortal, (NV)(n))
#define mPUSHi(i) sv_setiv_mg(PUSHmortal, (IV)(i))
#define mPUSHu(u) sv_setuv_mg(PUSHmortal, (UV)(u))
+#define mXPUSHs(s) XPUSHs(sv_2mortal(s))
#define XPUSHmortal XPUSHs(sv_newmortal())
#define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END
#define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END