summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-17 10:28:40 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-17 10:28:40 +0000
commit3ce4c5325c6bf80779666a9007ef3a4d29f4fce1 (patch)
treeaf874bc3fae848d84f4eacb116fd232866e50890 /doop.c
parent2d78db9da3a2e0242b1652394b939dc5b5fab5e5 (diff)
downloadperl-3ce4c5325c6bf80779666a9007ef3a4d29f4fce1.tar.gz
Revert 27856.
p4raw-id: //depot/perl@27857
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/doop.c b/doop.c
index 3143467e3d..5972dbd2a6 100644
--- a/doop.c
+++ b/doop.c
@@ -1185,7 +1185,6 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
const bool left_utf = DO_UTF8(left);
const bool right_utf = DO_UTF8(right);
I32 needlen = 0;
- bool needfree = FALSE;
if (left_utf && !right_utf)
sv_utf8_upgrade(right);
@@ -1198,12 +1197,9 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
rsave = rc = SvPV_nomg_const(right, rightlen);
len = leftlen < rightlen ? leftlen : rightlen;
lensave = len;
- SvCUR_set(sv, len);
- (void)SvPOK_only(sv);
if ((left_utf || right_utf) && (sv == left || sv == right)) {
needlen = optype == OP_BIT_AND ? len : leftlen + rightlen;
Newxz(dc, needlen + 1, char);
- needfree = TRUE;
}
else if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) {
dc = SvPV_force_nomg_nolen(sv);
@@ -1221,6 +1217,8 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
sv_usepvn_flags(sv, dc, needlen, SV_HAS_TRAILING_NUL);
dc = SvPVX(sv); /* sv_usepvn() calls Renew() */
}
+ SvCUR_set(sv, len);
+ (void)SvPOK_only(sv);
if (left_utf || right_utf) {
UV duc, luc, ruc;
char *dcorig = dc;
@@ -1241,10 +1239,8 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
duc = luc & ruc;
dc = (char*)uvchr_to_utf8((U8*)dc, duc);
}
- if (sv == left || sv == right) {
- (void)sv_usepvn(sv, dcorig, needlen); /* Uses Renew(). */
- needfree = FALSE; /* sv_usepvn() moved dcorig. */
- }
+ if (sv == left || sv == right)
+ (void)sv_usepvn(sv, dcorig, needlen);
SvCUR_set(sv, dc - dcorig);
break;
case OP_BIT_XOR:
@@ -1270,16 +1266,13 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
duc = luc | ruc;
dc = (char*)uvchr_to_utf8((U8*)dc, duc);
}
- goto mop_up_utf; /* For consistency. */
mop_up_utf:
if (rulen)
dcsave = savepvn(rc, rulen);
else if (lulen)
dcsave = savepvn(lc, lulen);
- if (sv == left || sv == right) {
+ if (sv == left || sv == right)
(void)sv_usepvn(sv, dcorig, needlen); /* Uses Renew(). */
- needfree = FALSE; /* sv_usepvn() moved dcorig. */
- }
SvCUR_set(sv, dc - dcorig);
if (rulen)
sv_catpvn(sv, dcsave, rulen);
@@ -1290,8 +1283,6 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
Safefree(dcsave);
break;
}
- if (needfree)
- Safefree(dcorig);
SvUTF8_on(sv);
goto finish;
}