diff options
author | Perl 5 Porters <perl5-porters.nicoh.com> | 1996-01-12 02:05:04 +0000 |
---|---|---|
committer | Andy Dougherty <doughera.lafayette.edu> | 1996-01-12 02:05:04 +0000 |
commit | 1476d272ad11d4ee4160587660fab223f7373e88 (patch) | |
tree | b09ce77586a7a69acfc8a45de41af0b645f4c42a | |
parent | 3c81428c5fa001df0f0ac7d48bfc483afd5efff5 (diff) | |
download | perl-1476d272ad11d4ee4160587660fab223f7373e88.tar.gz |
perl 5.002beta2 patch: doop.c
Chip's patch to use STDCHAR and U8 nearly everywhere instead of
assuming 8-bit chars or ~(char) 0 == 0xff.
-rw-r--r-- | doop.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -32,22 +32,22 @@ SV *sv; OP *arg; { register short *tbl; - register char *s; - register I32 matches = 0; + register U8 *s; + register U8 *send; + register U8 *d; register I32 ch; - register char *send; - register char *d; + register I32 matches = 0; register I32 squash = op->op_private & OPpTRANS_SQUASH; STRLEN len; if (SvREADONLY(sv)) croak(no_modify); - tbl = (short*) cPVOP->op_pv; - s = SvPV(sv, len); + tbl = (short*)cPVOP->op_pv; + s = (U8*)SvPV(sv, len); if (!len) return 0; if (!SvPOKp(sv)) - s = SvPV_force(sv, len); + s = (U8*)SvPV_force(sv, len); (void)SvPOK_only(sv); send = s + len; if (!tbl || !s) @@ -55,7 +55,7 @@ OP *arg; DEBUG_t( deb("2.TBL\n")); if (!op->op_private) { while (s < send) { - if ((ch = tbl[*s & 0377]) >= 0) { + if ((ch = tbl[*s]) >= 0) { matches++; *s = ch; } @@ -65,7 +65,7 @@ OP *arg; else { d = s; while (s < send) { - if ((ch = tbl[*s & 0377]) >= 0) { + if ((ch = tbl[*s]) >= 0) { *d = ch; if (matches++ && squash) { if (d[-1] == *d) @@ -82,7 +82,7 @@ OP *arg; } matches += send - d; /* account for disappeared chars */ *d = '\0'; - SvCUR_set(sv, d - SvPVX(sv)); + SvCUR_set(sv, d - (U8*)SvPVX(sv)); } SvSETMAGIC(sv); return matches; |