This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More SvPV consting
authorNicholas Clark <nick@ccl4.org>
Wed, 8 Jun 2005 22:48:00 +0000 (22:48 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 8 Jun 2005 22:48:00 +0000 (22:48 +0000)
p4raw-id: //depot/perl@24769

dump.c
mg.c
op.c
pp_hot.c
pp_sys.c
regexec.c

diff --git a/dump.c b/dump.c
index 85abf9c..bfa6727 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -770,7 +770,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
                SAVEFREESV(tmpsv);
                gv_fullname3(tmpsv, (GV*)cSVOPo->op_sv, Nullch);
                Perl_dump_indent(aTHX_ level, file, "GV = %s\n",
-                                SvPV_const_nolen(tmpsv));
+                                SvPV_nolen_const(tmpsv));
                LEAVE;
            }
            else
diff --git a/mg.c b/mg.c
index bcf6291..257d53d 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1289,7 +1289,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
     SV* save_sv;
 #endif
 
-    register const char *s = MgPV(mg,len);
+    register const char *s = MgPV_const(mg,len);
     if (*s == '_') {
        if (strEQ(s,"__DIE__"))
            svp = &PL_diehook;
diff --git a/op.c b/op.c
index 3728073..12a8c25 100644 (file)
--- a/op.c
+++ b/op.c
@@ -6781,7 +6781,7 @@ Perl_peep(pTHX_ register OP *o)
             SV *lexname;
            GV **fields;
            SV **svp, *sv;
-           char *key = NULL;
+           const char *key = NULL;
            STRLEN keylen;
 
            o->op_opt = 1;
@@ -6792,7 +6792,7 @@ Perl_peep(pTHX_ register OP *o)
            /* Make the CONST have a shared SV */
            svp = cSVOPx_svp(((BINOP*)o)->op_last);
            if ((!SvFAKE(sv = *svp) || !SvREADONLY(sv)) && !IS_PADCONST(sv)) {
-               key = SvPV(sv, keylen);
+               key = SvPV_const(sv, keylen);
                lexname = newSVpvn_share(key,
                                         SvUTF8(sv) ? -(I32)keylen : keylen,
                                         0);
index 6626b16..5088403 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1991,7 +1991,7 @@ PP(pp_subst)
        DIE(aTHX_ PL_no_modify);
     PUTBACK;
 
-    s = SvPV(TARG, len);
+    s = SvPV_mutable(TARG, len);
     if (!SvPOKp(TARG) || SvTYPE(TARG) == SVt_PVGV)
        force_on_match = 1;
     rxtainted = ((pm->op_pmdynflags & PMdf_TAINTED) ||
index fb508b5..ff80272 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3449,7 +3449,7 @@ PP(pp_fttext)
       really_filename:
        PL_statgv = Nullgv;
        PL_laststype = OP_STAT;
-       sv_setpv(PL_statname, SvPV_nolen(sv));
+       sv_setpv(PL_statname, SvPV_nolen_const(sv));
        if (!(fp = PerlIO_open(SvPVX_const(PL_statname), "r"))) {
            if (ckWARN(WARN_NEWLINE) && strchr(SvPV_nolen(PL_statname), '\n'))
                Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open");
index 8b305e8..d412ef8 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -2070,7 +2070,7 @@ got_it:
                                  (int) SvTYPE(sv));
                }
                prog->saved_copy = sv_setsv_cow(prog->saved_copy, sv);
-               prog->subbeg = SvPVX(prog->saved_copy);
+               prog->subbeg = (char *)SvPVX_const(prog->saved_copy);
                assert (SvPOKp(prog->saved_copy));
            } else
 #endif