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)
}
if (DO_UTF8(sv)) {
- U8 *s = (U8*)SvPV(sv, len);
+ const U8 *s = (U8*)SvPV_const(sv, len);
len = Perl_utf8_length(aTHX_ s, s + len);
}
else
- (void)SvPV(sv, len);
+ (void)SvPV_const(sv, len);
return len;
}
case 0:
call_list_body(cv);
atsv = ERRSV;
- (void)SvPV(atsv, len);
+ (void)SvPV_const(atsv, len);
if (len) {
PL_curcop = &PL_compiling;
CopLINE_set(PL_curcop, oldline);
register I32 anum;
STRLEN len;
- (void)SvPV_nomg(sv,len); /* force check for uninit var */
+ (void)SvPV_nomg_const(sv,len); /* force check for uninit var */
sv_setsv_nomg(TARG, sv);
tmps = (U8*)SvPV_force(TARG, len);
anum = len;
SV *temp = Nullsv;
I32 offset;
I32 retval;
- char *tmps;
- char *tmps2;
+ const char *tmps;
+ const char *tmps2;
STRLEN biglen;
I32 arybase = PL_curcop->cop_arybase;
int big_utf8;
/* One needs to be upgraded. */
SV *bytes = little_utf8 ? big : little;
STRLEN len;
- char *p = SvPV(bytes, len);
+ const char *p = SvPV_const(bytes, len);
temp = newSVpvn(p, len);
}
if (big_utf8 && offset > 0)
sv_pos_u2b(big, &offset, 0);
- tmps = SvPV(big, biglen);
+ tmps = SvPV_const(big, biglen);
if (offset < 0)
offset = 0;
else if (offset > (I32)biglen)
STRLEN llen;
I32 offset;
I32 retval;
- char *tmps;
- char *tmps2;
+ const char *tmps;
+ const char *tmps2;
I32 arybase = PL_curcop->cop_arybase;
int big_utf8;
int little_utf8;
little = temp;
}
}
- tmps2 = SvPV(little, llen);
- tmps = SvPV(big, blen);
+ tmps2 = SvPV_const(little, llen);
+ tmps = SvPV_const(big, blen);
if (MAXARG < 3)
offset = blen;
dPOPTOPssrl;
STRLEN n_a;
STRLEN len;
- char *tmps = SvPV(left, len);
+ const char *tmps = SvPV_const(left, len);
if (DO_UTF8(left)) {
/* If Unicode, try to downgrade.
{
dSP;
SV *sv = TOPs;
- register U8 *s;
STRLEN len;
SvGETMAGIC(sv);
dTARGET;
STRLEN ulen;
register U8 *d;
- U8 *send;
+ const U8 *s;
+ const U8 *send;
U8 tmpbuf[UTF8_MAXBYTES+1];
- s = (U8*)SvPV_nomg(sv,len);
+ s = (const U8*)SvPV_nomg_const(sv,len);
if (!len) {
SvUTF8_off(TARG); /* decontaminate */
sv_setpvn(TARG, "", 0);
}
}
else {
+ U8 *s;
if (!SvPADTMP(sv) || SvREADONLY(sv)) {
dTARGET;
SvUTF8_off(TARG); /* decontaminate */
}
s = (U8*)SvPV_force_nomg(sv, len);
if (len) {
- register U8 *send = s + len;
+ const register U8 *send = s + len;
if (IN_LOCALE_RUNTIME) {
TAINT;
{
dSP;
SV *sv = TOPs;
- register U8 *s;
STRLEN len;
SvGETMAGIC(sv);
if (DO_UTF8(sv)) {
dTARGET;
+ const U8 *s;
STRLEN ulen;
register U8 *d;
- U8 *send;
+ const U8 *send;
U8 tmpbuf[UTF8_MAXBYTES_CASE+1];
- s = (U8*)SvPV_nomg(sv,len);
+ s = (const U8*)SvPV_nomg_const(sv,len);
if (!len) {
SvUTF8_off(TARG); /* decontaminate */
sv_setpvn(TARG, "", 0);
}
}
else {
+ U8 *s;
if (!SvPADTMP(sv) || SvREADONLY(sv)) {
dTARGET;
SvUTF8_off(TARG); /* decontaminate */
STRLEN n_a;
cx->blk_loop.iterlval = newSVsv(sv);
(void) SvPV_force(cx->blk_loop.iterlval,n_a);
- (void) SvPV(right,n_a);
+ (void) SvPV_nolen_const(right);
}
}
else if (PL_op->op_private & OPpITER_REVERSED) {
mg_get(left); /* or mg_get(left) may happen here */
if (!SvOK(TARG))
sv_setpvn(left, "", 0);
- (void)SvPV_nomg(left, llen); /* Needed to set UTF8 flag */
+ (void)SvPV_nomg_const(left, llen); /* Needed to set UTF8 flag */
lbyte = !DO_UTF8(left);
if (IN_BYTES)
SvUTF8_off(TARG);
continue;
}
if (++bytes >= sizeof(UV)) { /* promote to string */
- char *t;
- STRLEN n_a;
+ const char *t;
sv = Perl_newSVpvf(aTHX_ "%.*"UVf, (int)TYPE_DIGITS(UV), auv);
while (s < strend) {
break;
}
}
- t = SvPV(sv, n_a);
+ t = SvPV_nolen_const(sv);
while (*t == '0')
t++;
sv_chop(sv, t);
}
case 'H':
case 'h': {
- char *str, *end;
+ const char *str, *end;
I32 l, field_len;
U8 bits;
bool utf8_source;
U32 utf8_flags;
fromstr = NEXTFROM;
- str = SvPV(fromstr, fromlen);
+ str = SvPV_const(fromstr, fromlen);
end = str + fromlen;
if (DO_UTF8(fromstr)) {
utf8_source = TRUE;
dSP;
#ifdef HAS_SYMLINK
dTARGET;
- char *tmps;
+ const char *tmps;
char buf[MAXPATHLEN];
int len;
STRLEN n_a;
#ifndef INCOMPLETE_TAINTS
TAINT;
#endif
- tmps = POPpx;
+ tmps = POPpconstx;
len = readlink(tmps, buf, sizeof(buf) - 1);
EXTEND(SP, 1);
if (len < 0)
#if defined(Direntry_t) && defined(HAS_READDIR)
dSP;
STRLEN n_a;
- char *dirname = POPpx;
+ const char *dirname = POPpconstx;
GV *gv = (GV*)POPs;
register IO *io = GvIOn(gv);
if (PL_tainting) {
TAINT_ENV();
while (++MARK <= SP) {
- (void)SvPV_nolen(*MARK); /* stringify for taint check */
+ (void)SvPV_nolen_const(*MARK); /* stringify for taint check */
if (PL_tainted)
break;
}
if (PL_tainting) {
TAINT_ENV();
while (++MARK <= SP) {
- (void)SvPV_nolen(*MARK); /* stringify for taint check */
+ (void)SvPV_nolen_const(*MARK); /* stringify for taint check */
if (PL_tainted)
break;
}
mg_get(sv);
if (SvPOKp(sv)) {
*lp = SvCUR(sv);
+ if (flags & SV_MUTABLE_RETURN)
+ return SvPVX_mutable(sv);
if (flags & SV_CONST_RETURN)
return (char *)SvPVX_const(sv);
return SvPVX(sv);
PTR2UV(sv),SvPVX_const(sv)));
if (flags & SV_CONST_RETURN)
return (char *)SvPVX_const(sv);
+ if (flags & SV_MUTABLE_RETURN)
+ return SvPVX_mutable(sv);
return SvPVX(sv);
tokensave: