From: Marcus Holland-Moritz Date: Fri, 4 Jan 2008 12:28:54 +0000 (+0000) Subject: There's no need to handle 'set' magic in the mX?PUSH macros. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=121b77126d4ab6098abde56a8c4175a9704d61b2;p=p5sagit%2Fp5-mst-13.2.git There's no need to handle 'set' magic in the mX?PUSH macros. The macros all create new mortals using sv_newmortal(), and those cannot be magical. This is in contrary to the X?PUSH macros, which operate on TARG, which can be magical. With that in mind, mentioning whether or not mX?PUSH can handle 'set' magic doesn't make sense any longer. p4raw-id: //depot/perl@32824 --- diff --git a/pod/perlapi.pod b/pod/perlapi.pod index 0abddef..c46f697 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -3306,8 +3306,7 @@ Found in file pp.h X Push an integer onto the stack. The stack must have room for this element. -Handles 'set' magic. Does not use C. See also C, C -and C. +Does not use C. See also C, C and C. void mPUSHi(IV iv) @@ -3318,8 +3317,7 @@ Found in file pp.h X Push a double onto the stack. The stack must have room for this element. -Handles 'set' magic. Does not use C. See also C, C -and C. +Does not use C. See also C, C and C. void mPUSHn(NV nv) @@ -3330,8 +3328,8 @@ Found in file pp.h X Push a string onto the stack. The stack must have room for this element. -The C indicates the length of the string. Handles 'set' magic. Does -not use C. See also C, C and C. +The C indicates the length of the string. Does not use C. +See also C, C and C. void mPUSHp(char* str, STRLEN len) @@ -3342,8 +3340,7 @@ Found in file pp.h X 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. -See also C and C. +for this element. Does not use C. See also C and C. void mPUSHs(SV* sv) @@ -3354,8 +3351,7 @@ Found in file pp.h X Push an unsigned integer onto the stack. The stack must have room for this -element. Handles 'set' magic. Does not use C. See also C, -C and C. +element. Does not use C. See also C, C and C. void mPUSHu(UV uv) @@ -3365,9 +3361,8 @@ Found in file pp.h =item mXPUSHi X -Push an integer onto the stack, extending the stack if necessary. Handles -'set' magic. Does not use C. See also C, C and -C. +Push an integer onto the stack, extending the stack if necessary. +Does not use C. See also C, C and C. void mXPUSHi(IV iv) @@ -3377,9 +3372,8 @@ Found in file pp.h =item mXPUSHn X -Push a double onto the stack, extending the stack if necessary. Handles -'set' magic. Does not use C. See also C, C and -C. +Push a double onto the stack, extending the stack if necessary. +Does not use C. See also C, C and C. void mXPUSHn(NV nv) @@ -3390,8 +3384,8 @@ Found in file pp.h X Push a string onto the stack, extending the stack if necessary. The C -indicates the length of the string. Handles 'set' magic. Does not use -C. See also C, C and C. +indicates the length of the string. Does not use C. See also C, +C and C. void mXPUSHp(char* str, STRLEN len) @@ -3402,8 +3396,7 @@ Found in file pp.h X Push an SV onto the stack, extending the stack if necessary and mortalizes -the SV. Does not handle 'set' magic. Does not use C. See also -C and C. +the SV. Does not use C. See also C and C. void mXPUSHs(SV* sv) @@ -3414,8 +3407,7 @@ Found in file pp.h X Push an unsigned integer onto the stack, extending the stack if necessary. -Handles 'set' magic. Does not use C. See also C, C -and C. +Does not use C. See also C, C and C. void mXPUSHu(UV uv) @@ -3529,8 +3521,7 @@ Found in file pp.h X 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. See also -C, C and C. +element. Does not use C. See also C, C and C. void PUSHmortal() @@ -3637,9 +3628,8 @@ Found in file pp.h =item XPUSHmortal X -Push a new mortal SV onto the stack, extending the stack if necessary. Does -not handle 'set' magic. Does not use C. See also C, -C and C. +Push a new mortal SV onto the stack, extending the stack if necessary. +Does not use C. See also C, C and C. void XPUSHmortal() diff --git a/pp.h b/pp.h index c2cf691..47a48d5 100644 --- a/pp.h +++ b/pp.h @@ -226,63 +226,53 @@ C. =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. -See also C and C. +for this element. Does not use C. See also C and C. =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. See also -C, C and C. +element. Does not use C. See also C, C and C. =for apidoc Am|void|mPUSHp|char* str|STRLEN len Push a string onto the stack. The stack must have room for this element. -The C indicates the length of the string. Handles 'set' magic. Does -not use C. See also C, C and C. +The C indicates the length of the string. Does not use C. +See also C, C and C. =for apidoc Am|void|mPUSHn|NV nv Push a double onto the stack. The stack must have room for this element. -Handles 'set' magic. Does not use C. See also C, C -and C. +Does not use C. See also C, C and C. =for apidoc Am|void|mPUSHi|IV iv Push an integer onto the stack. The stack must have room for this element. -Handles 'set' magic. Does not use C. See also C, C -and C. +Does not use C. See also C, C and C. =for apidoc Am|void|mPUSHu|UV uv Push an unsigned integer onto the stack. The stack must have room for this -element. Handles 'set' magic. Does not use C. See also C, -C and C. +element. Does not use C. See also C, C and C. =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. See also -C and C. +the SV. Does not use C. See also C and C. =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. See also C, -C and C. +Push a new mortal SV onto the stack, extending the stack if necessary. +Does not use C. See also C, C and C. =for apidoc Am|void|mXPUSHp|char* str|STRLEN len Push a string onto the stack, extending the stack if necessary. The C -indicates the length of the string. Handles 'set' magic. Does not use -C. See also C, C and C. +indicates the length of the string. Does not use C. See also C, +C and C. =for apidoc Am|void|mXPUSHn|NV nv -Push a double onto the stack, extending the stack if necessary. Handles -'set' magic. Does not use C. See also C, C and -C. +Push a double onto the stack, extending the stack if necessary. +Does not use C. See also C, C and C. =for apidoc Am|void|mXPUSHi|IV iv -Push an integer onto the stack, extending the stack if necessary. Handles -'set' magic. Does not use C. See also C, C and -C. +Push an integer onto the stack, extending the stack if necessary. +Does not use C. See also C, C and C. =for apidoc Am|void|mXPUSHu|UV uv Push an unsigned integer onto the stack, extending the stack if necessary. -Handles 'set' magic. Does not use C. See also C, C -and C. +Does not use C. See also C, C and C. =cut */ @@ -315,17 +305,17 @@ and C. #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 mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l)) +#define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n)) +#define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i)) +#define mPUSHu(u) sv_setuv(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 -#define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END -#define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END +#define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END +#define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END +#define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END +#define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END #define SETs(s) (*sp = s) #define SETTARG STMT_START { SvSETMAGIC(TARG); SETs(TARG); } STMT_END