diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-06-02 06:07:53 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-06-02 06:07:53 +0000 |
commit | e1f795dc699c88c2d9eb4a46fe629483760393c2 (patch) | |
tree | b441815162375621cd823107a2da6a026bd2ce1e /pp.c | |
parent | 533968fe05e828818d78b731fade41cae15a5f2a (diff) | |
download | perl-e1f795dc699c88c2d9eb4a46fe629483760393c2.tar.gz |
Make the dUNDERBAR/UNDERBAR macros work as advertised.
While we're at it, use the same trick to make reverse()
work correctly with lexical $_.
p4raw-id: //depot/perl@22889
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -4334,12 +4334,17 @@ PP(pp_reverse) register I32 tmp; dTARGET; STRLEN len; + I32 padoff_du; SvUTF8_off(TARG); /* decontaminate */ if (SP - MARK > 1) do_join(TARG, &PL_sv_no, MARK, SP); else - sv_setsv(TARG, (SP > MARK) ? *SP : DEFSV); + sv_setsv(TARG, (SP > MARK) + ? *SP + : (padoff_du = Perl_find_rundefsvoffset(), + (padoff_du == NOT_IN_PAD || PAD_COMPNAME_FLAGS(padoff_du) & SVpad_OUR) + ? DEFSV : PAD_SVl(padoff_du))); up = SvPV_force(TARG, len); if (len > 1) { if (DO_UTF8(TARG)) { /* first reverse each character */ |