/* doop.c
*
- * Copyright (c) 1991-2002, Larry Wall
+ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ * 2000, 2001, 2002, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
#include "perl.h"
#ifndef PERL_MICRO
-#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX)
#include <signal.h>
#endif
-#endif
STATIC I32
S_do_trans_simple(pTHX_ SV *sv)
s = (U8*)SvPV(sv, len);
send = s + len;
- /* First, take care of non-UTF8 input strings, because they're easy */
+ /* First, take care of non-UTF-8 input strings, because they're easy */
if (!SvUTF8(sv)) {
while (s < send) {
if ((ch = tbl[*s]) >= 0) {
s += ulen;
}
else { /* No match -> copy */
- Copy(s, d, ulen, U8);
+ Move(s, d, ulen, U8);
d += ulen;
s += ulen;
}
UV comp = utf8_to_uvchr(s, &len);
if (comp > 0xff) {
if (!complement) {
- Copy(s, d, len, U8);
+ Move(s, d, len, U8);
d += len;
}
else {
}
else if (uv == none) {
int i = UTF8SKIP(s);
- Copy(s, d, i, U8);
+ Move(s, d, i, U8);
d += i;
s += i;
}
}
else if (uv == none) { /* "none" is unmapped character */
int i = UTF8SKIP(s);
- Copy(s, d, i, U8);
+ Move(s, d, i, U8);
d += i;
s += i;
puv = 0xfeedface;
STRLEN len;
uv = utf8_to_uvuni(s, &len);
if (uv != puv) {
- Copy(s, d, len, U8);
+ Move(s, d, len, U8);
d += len;
puv = uv;
}
}
else if (uv == none) { /* "none" is unmapped character */
int i = UTF8SKIP(s);
- Copy(s, d, i, U8);
+ Move(s, d, i, U8);
d += i;
s += i;
continue;
(OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF));
if (SvREADONLY(sv)) {
- if (SvFAKE(sv))
- sv_force_normal(sv);
+ if (SvIsCOW(sv))
+ sv_force_normal_flags(sv, 0);
if (SvREADONLY(sv) && !(PL_op->op_private & OPpTRANS_IDENTICAL))
Perl_croak(aTHX_ PL_no_modify);
}
(void)SvPV(sv, len);
if (!len)
return 0;
- if (!SvPOKp(sv))
- (void)SvPV_force(sv, len);
- if (!(PL_op->op_private & OPpTRANS_IDENTICAL))
+ if (!(PL_op->op_private & OPpTRANS_IDENTICAL)) {
+ if (!SvPOKp(sv))
+ (void)SvPV_force(sv, len);
(void)SvPOK_only_UTF8(sv);
+ }
DEBUG_t( Perl_deb(aTHX_ "2.TBL\n"));
I32 gimme = GIMME_V;
I32 dokeys = (PL_op->op_type == OP_KEYS);
I32 dovalues = (PL_op->op_type == OP_VALUES);
- I32 realhv = (SvTYPE(hv) == SVt_PVHV);
if (PL_op->op_type == OP_RV2HV || PL_op->op_type == OP_PADHV)
dokeys = dovalues = TRUE;
RETURN;
}
- keys = realhv ? hv : avhv_keys((AV*)hv);
+ keys = hv;
(void)hv_iterinit(keys); /* always reset iterator regardless */
if (gimme == G_VOID)
}
if (dovalues) {
PUTBACK;
- tmpstr = realhv ?
- hv_iterval(hv,entry) : avhv_iterval((AV*)hv,entry);
+ tmpstr = hv_iterval(hv,entry);
DEBUG_H(Perl_sv_setpvf(aTHX_ tmpstr, "%lu%%%d=%lu",
(unsigned long)HeHASH(entry),
HvMAX(keys)+1,