STATIC I32
S_do_trans_count(pTHX_ SV *sv)
{
- U8 *s;
- U8 *send;
+ const U8 *s;
+ const U8 *send;
I32 matches = 0;
STRLEN len;
const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
if (!tbl)
Perl_croak(aTHX_ "panic: do_trans_count line %d",__LINE__);
- s = (U8*)SvPV(sv, len);
+ s = (const U8*)SvPV_const(sv, len);
send = s + len;
if (!SvUTF8(sv))
STATIC I32
S_do_trans_count_utf8(pTHX_ SV *sv)
{
- U8 *s;
- U8 *start = 0, *send;
+ const U8 *s;
+ const U8 *start = 0, *send;
I32 matches = 0;
STRLEN len;
const UV extra = none + 1;
U8 hibit = 0;
- s = (U8*)SvPV(sv, len);
+ s = (const U8*)SvPV_const(sv, len);
if (!SvUTF8(sv)) {
const U8 *t = s;
const U8 *e = s + len;
if (SvREADONLY(sv) && !(PL_op->op_private & OPpTRANS_IDENTICAL))
Perl_croak(aTHX_ PL_no_modify);
}
- (void)SvPV(sv, len);
+ (void)SvPV_const(sv, len);
if (!len)
return 0;
if (!(PL_op->op_private & OPpTRANS_IDENTICAL)) {
Perl_do_vecget(pTHX_ SV *sv, I32 offset, I32 size)
{
STRLEN srclen, len;
- unsigned char *s = (unsigned char *) SvPV(sv, srclen);
+ const unsigned char *s = (const unsigned char *) SvPV_const(sv, srclen);
UV retnum = 0;
if (offset < 0)
{
register I32 count;
STRLEN len;
- STRLEN n_a;
char *s;
char *temp_buffer = NULL;
SV* svrecode = Nullsv;
}
else {
STRLEN rslen, rs_charlen;
- char *rsptr = SvPV(PL_rs, rslen);
+ const char *rsptr = SvPV_const(PL_rs, rslen);
rs_charlen = SvUTF8(PL_rs)
? sv_len_utf8(PL_rs)
* Do not recode PL_rs as a side-effect. */
svrecode = newSVpvn(rsptr, rslen);
sv_recode_to_utf8(svrecode, PL_encoding);
- rsptr = SvPV(svrecode, rslen);
+ rsptr = SvPV_const(svrecode, rslen);
rs_charlen = sv_len_utf8(svrecode);
}
else {
count += rs_charlen;
}
}
- s = SvPV_force(sv, n_a);
+ s = SvPV_force_nolen(sv);
SvCUR_set(sv, len);
*SvEND(sv) = '\0';
SvNIOK_off(sv);
register char *dc;
STRLEN leftlen;
STRLEN rightlen;
- register char *lc;
- register char *rc;
+ register const char *lc;
+ register const char *rc;
register I32 len;
I32 lensave;
- char *lsave;
- char *rsave;
+ const char *lsave;
+ const char *rsave;
const bool left_utf = DO_UTF8(left);
const bool right_utf = DO_UTF8(right);
I32 needlen = 0;
if (sv != left || (optype != OP_BIT_AND && !SvOK(sv) && !SvGMAGICAL(sv)))
sv_setpvn(sv, "", 0); /* avoid undef warning on |= and ^= */
- lsave = lc = SvPV_nomg(left, leftlen);
- rsave = rc = SvPV_nomg(right, rightlen);
+ lsave = lc = SvPV_nomg_const(left, leftlen);
+ rsave = rc = SvPV_nomg_const(right, rightlen);
len = leftlen < rightlen ? leftlen : rightlen;
lensave = len;
if ((left_utf || right_utf) && (sv == left || sv == right)) {