summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-02 06:07:53 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-02 06:07:53 +0000
commite1f795dc699c88c2d9eb4a46fe629483760393c2 (patch)
treeb441815162375621cd823107a2da6a026bd2ce1e /pp.c
parent533968fe05e828818d78b731fade41cae15a5f2a (diff)
downloadperl-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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 60eaf2867a..c0c742052a 100644
--- a/pp.c
+++ b/pp.c
@@ -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 */