summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2005-12-27 08:39:39 -0600
committerSteve Peters <steve@fisharerojo.org>2005-12-27 22:07:44 +0000
commitfabdb6c0879db76333e970b6c67260c877fc17b3 (patch)
tree81d106dc99b2069f6968bbe00164e6bb222dc482 /doop.c
parentf319e147b252268cc6fe404c58538ec32cf8548a (diff)
downloadperl-fabdb6c0879db76333e970b6c67260c877fc17b3.tar.gz
pre-likely cleanup
Message-ID: <20051227203939.GC1781@petdance.com> Includes a small fix to the changes in tryAMAGICbinW_var() in pp.h. p4raw-id: //depot/perl@26505
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/doop.c b/doop.c
index 09cb6f5310..75cbd3ec40 100644
--- a/doop.c
+++ b/doop.c
@@ -100,7 +100,6 @@ S_do_trans_count(pTHX_ SV *sv)
const U8 *send;
I32 matches = 0;
STRLEN len;
- const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
const short * const tbl = (short*)cPVOP->op_pv;
if (!tbl)
@@ -114,7 +113,8 @@ S_do_trans_count(pTHX_ SV *sv)
if (tbl[*s++] >= 0)
matches++;
}
- else
+ else {
+ const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
while (s < send) {
STRLEN ulen;
const UV c = utf8n_to_uvchr(s, send - s, &ulen, 0);
@@ -125,6 +125,7 @@ S_do_trans_count(pTHX_ SV *sv)
matches++;
s += ulen;
}
+ }
return matches;
}
@@ -138,9 +139,6 @@ S_do_trans_complex(pTHX_ SV *sv)
U8 *dstart;
I32 isutf8;
I32 matches = 0;
- const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
- const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
- const I32 del = PL_op->op_private & OPpTRANS_DELETE;
STRLEN len, rlen = 0;
const short * const tbl = (short*)cPVOP->op_pv;
@@ -188,6 +186,10 @@ S_do_trans_complex(pTHX_ SV *sv)
SvCUR_set(sv, d - dstart);
}
else { /* isutf8 */
+ const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
+ const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
+ const I32 del = PL_op->op_private & OPpTRANS_DELETE;
+
if (grows)
Newx(d, len*2+1, U8);
else
@@ -321,11 +323,12 @@ S_do_trans_simple_utf8(pTHX_ SV *sv)
const U8 * const e = s + len;
while (t < e) {
const U8 ch = *t++;
- if ((hibit = !NATIVE_IS_INVARIANT(ch)))
+ hibit = !NATIVE_IS_INVARIANT(ch);
+ if (hibit) {
+ s = bytes_to_utf8(s, &len);
break;
+ }
}
- if (hibit)
- s = bytes_to_utf8(s, &len);
}
send = s + len;
start = s;
@@ -413,11 +416,12 @@ S_do_trans_count_utf8(pTHX_ SV *sv)
const U8 * const e = s + len;
while (t < e) {
const U8 ch = *t++;
- if ((hibit = !NATIVE_IS_INVARIANT(ch)))
+ hibit = !NATIVE_IS_INVARIANT(ch);
+ if (hibit) {
+ start = s = bytes_to_utf8(s, &len);
break;
+ }
}
- if (hibit)
- start = s = bytes_to_utf8(s, &len);
}
send = s + len;
@@ -460,11 +464,12 @@ S_do_trans_complex_utf8(pTHX_ SV *sv)
const U8 * const e = s + len;
while (t < e) {
const U8 ch = *t++;
- if ((hibit = !NATIVE_IS_INVARIANT(ch)))
+ hibit = !NATIVE_IS_INVARIANT(ch);
+ if (hibit) {
+ s = bytes_to_utf8(s, &len);
break;
+ }
}
- if (hibit)
- s = bytes_to_utf8(s, &len);
}
send = s + len;
start = s;