diff options
author | David Mitchell <davem@iabyn.com> | 2018-02-16 14:10:40 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-02-19 22:06:49 +0000 |
commit | 16fe3f8a9e2ea46c1f8b8078916520fd6bf0a0b1 (patch) | |
tree | 9efa3e957cf113d8399f8133e37113958c5e0329 | |
parent | 6d37ab4efc1fb099593fb29406193ae79c3be543 (diff) | |
download | perl-16fe3f8a9e2ea46c1f8b8078916520fd6bf0a0b1.tar.gz |
move body of pp_concat() to S_do_concat()
Create an inline static function which implements the body of pp_concat(),
then replace pp_concat()'s body with a call to it.
Shortly, we'll use this function in pp_multiconcat() too.
-rw-r--r-- | pp_hot.c | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -253,11 +253,17 @@ PP(pp_unstack) return NORMAL; } -PP(pp_concat) + +/* The main body of pp_concat, not including the magic/overload and + * stack handling. + * It does targ = left . right. + * Moved into a separate function so that pp_multiconcat() can use it + * too. + */ + +PERL_STATIC_INLINE void +S_do_concat(pTHX_ SV *left, SV *right, SV *targ, U8 targmy) { - dSP; dATARGET; tryAMAGICbin_MG(concat_amg, AMGf_assign); - { - dPOPTOPssrl; bool lbyte; STRLEN rlen; const char *rpv = NULL; @@ -285,7 +291,7 @@ PP(pp_concat) else { /* $l .= $r and left == TARG */ if (!SvOK(left)) { if ((left == right /* $l .= $l */ - || (PL_op->op_private & OPpTARGET_MY)) /* $l = $l . $r */ + || targmy) /* $l = $l . $r */ && ckWARN(WARN_UNINITIALIZED) ) report_uninit(left); @@ -314,8 +320,17 @@ PP(pp_concat) } } sv_catpvn_nomg(TARG, rpv, rlen); + SvSETMAGIC(TARG); +} - SETTARG; + +PP(pp_concat) +{ + dSP; dATARGET; tryAMAGICbin_MG(concat_amg, AMGf_assign); + { + dPOPTOPssrl; + S_do_concat(aTHX_ left, right, targ, PL_op->op_private & OPpTARGET_MY); + SETs(TARG); RETURN; } } |