Propagate const/mutable/not into the SvPV call for retrieving an
[p5sagit/p5-mst-13.2.git] / doop.c
diff --git a/doop.c b/doop.c
index d7ab071..73ccdcd 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -97,8 +97,8 @@ S_do_trans_simple(pTHX_ SV *sv)
 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;
@@ -107,7 +107,7 @@ S_do_trans_count(pTHX_ SV *sv)
     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))
@@ -395,8 +395,8 @@ S_do_trans_simple_utf8(pTHX_ SV *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;
 
@@ -407,7 +407,7 @@ S_do_trans_count_utf8(pTHX_ SV *sv)
     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;
@@ -605,7 +605,7 @@ Perl_do_trans(pTHX_ SV *sv)
         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)) {
@@ -717,7 +717,7 @@ UV
 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)
@@ -1006,7 +1006,6 @@ Perl_do_chomp(pTHX_ register SV *sv)
 {
     register I32 count;
     STRLEN len;
-    STRLEN n_a;
     char *s;
     char *temp_buffer = NULL;
     SV* svrecode = Nullsv;
@@ -1072,7 +1071,7 @@ Perl_do_chomp(pTHX_ register SV *sv)
        }
        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)
@@ -1099,7 +1098,7 @@ Perl_do_chomp(pTHX_ register SV *sv)
                     * 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 {
@@ -1123,7 +1122,7 @@ Perl_do_chomp(pTHX_ register SV *sv)
                count += rs_charlen;
            }
        }
-       s = SvPV_force(sv, n_a);
+       s = SvPV_force_nolen(sv);
        SvCUR_set(sv, len);
        *SvEND(sv) = '\0';
        SvNIOK_off(sv);