summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2005-03-21 18:35:55 -0600
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-03-24 16:25:58 +0000
commite1ec3a884f8d8c64eb7e391b2a363f47cbeed570 (patch)
tree13e83e61449ed542f309f1cd88e7ed42778ca543
parent2bbb3949e88673e7f0574ab70254a46d776242e9 (diff)
downloadperl-e1ec3a884f8d8c64eb7e391b2a363f47cbeed570.tar.gz
Third consting batch
Message-Id: <2f14220e7101a03f7659dbe79a03b115@petdance.com> p4raw-id: //depot/perl@24074
-rw-r--r--XSUB.h2
-rw-r--r--deb.c11
-rw-r--r--doio.c15
-rw-r--r--dump.c38
-rw-r--r--embed.fnc98
-rw-r--r--gv.c24
-rw-r--r--gv.h2
-rw-r--r--hv.c2
-rw-r--r--mg.c18
-rw-r--r--mg.h2
-rw-r--r--minimod.pl2
-rw-r--r--numeric.c10
-rw-r--r--op.c44
-rw-r--r--pad.c67
-rw-r--r--patchlevel.h2
-rw-r--r--perl.c58
-rw-r--r--perl.h6
-rw-r--r--perlio.c3
-rw-r--r--perliol.h2
-rw-r--r--perlvars.h2
-rw-r--r--perly.c12
-rw-r--r--pod/perlapi.pod18
-rw-r--r--pod/perlintern.pod10
-rw-r--r--pp.c18
-rw-r--r--pp_hot.c6
-rw-r--r--pp_sys.c12
-rw-r--r--proto.h94
-rw-r--r--regcomp.c43
-rw-r--r--regcomp.h4
-rw-r--r--regexec.c2
-rw-r--r--scope.c2
-rw-r--r--sv.c83
-rw-r--r--taint.c8
-rw-r--r--universal.c10
-rw-r--r--utf8.c45
-rw-r--r--utf8.h10
-rw-r--r--utfebcdic.h6
-rw-r--r--util.c97
-rw-r--r--writemain.SH2
-rw-r--r--xsutils.c4
40 files changed, 441 insertions, 453 deletions
diff --git a/XSUB.h b/XSUB.h
index c74d6f6385..bc08dda26c 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -245,7 +245,7 @@ Rethrows a previously caught exception. See L<perlguts/"Exception Handling">.
# define XS_VERSION_BOOTCHECK \
STMT_START { \
SV *_sv; STRLEN n_a; \
- char *vn = Nullch, *module = SvPV(ST(0),n_a); \
+ const char *vn = Nullch, *module = SvPV(ST(0),n_a); \
if (items >= 2) /* version supplied as bootstrap arg */ \
_sv = ST(1); \
else { \
diff --git a/deb.c b/deb.c
index 4bb91add40..7a09f95716 100644
--- a/deb.c
+++ b/deb.c
@@ -173,7 +173,6 @@ Perl_deb_stack_all(pTHX)
#ifdef DEBUGGING
I32 ix, si_ix;
PERL_SI *si;
- PERL_CONTEXT *cx;
/* rewind to start of chain */
si = PL_curstackinfo;
@@ -183,18 +182,14 @@ Perl_deb_stack_all(pTHX)
si_ix=0;
for (;;)
{
- char *si_name;
- int si_name_ix = si->si_type+1; /* -1 is a valid index */
- if (si_name_ix>= sizeof(si_names))
- si_name = "????";
- else
- si_name = si_names[si_name_ix];
+ const int si_name_ix = si->si_type+1; /* -1 is a valid index */
+ const char *si_name = (si_name_ix>= sizeof(si_names)) ? "????" : si_names[si_name_ix];
PerlIO_printf(Perl_debug_log, "STACK %"IVdf": %s\n",
(IV)si_ix, si_name);
for (ix=0; ix<=si->si_cxix; ix++) {
- cx = &(si->si_cxstack[ix]);
+ const PERL_CONTEXT *cx = &(si->si_cxstack[ix]);
PerlIO_printf(Perl_debug_log,
" CX %"IVdf": %-6s => ",
(IV)ix, PL_block_type[CxTYPE(cx)]
diff --git a/doio.c b/doio.c
index df7f656c87..c8bc22dd5c 100644
--- a/doio.c
+++ b/doio.c
@@ -147,7 +147,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
if (as_raw) {
/* sysopen style args, i.e. integer mode and permissions */
STRLEN ix = 0;
- int appendtrunc =
+ const int appendtrunc =
0
#ifdef O_APPEND /* Not fully portable. */
|O_APPEND
@@ -156,8 +156,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
|O_TRUNC
#endif
;
- int modifyingmode =
- O_WRONLY|O_RDWR|O_CREAT|appendtrunc;
+ int modifyingmode = O_WRONLY|O_RDWR|O_CREAT|appendtrunc;
int ismodifying;
if (num_svs != 0) {
@@ -353,7 +352,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
fd = atoi(type);
}
else {
- IO* thatio;
+ const IO* thatio;
if (num_svs) {
thatio = sv_2io(*svp);
}
@@ -1235,7 +1234,7 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)
/* The old body of this is now in non-LAYER part of perlio.c
* This is a stub for any XS code which might have been calling it.
*/
- char *name = ":raw";
+ const char *name = ":raw";
#ifdef PERLIO_USING_CRLF
if (!(mode & O_BINARY))
name = ":crlf";
@@ -1297,7 +1296,7 @@ Off_t length; /* length to set file to */
bool
Perl_do_print(pTHX_ register SV *sv, PerlIO *fp)
{
- register char *tmps;
+ register const char *tmps;
STRLEN len;
/* assuming fp is checked earlier */
@@ -1473,7 +1472,7 @@ Perl_do_aexec5(pTHX_ SV *really, register SV **mark, register SV **sp,
Perl_croak(aTHX_ "exec? I'm not *that* kind of operating system");
#else
register char **a;
- char *tmps = Nullch;
+ const char *tmps = Nullch;
STRLEN n_a;
if (sp > mark) {
@@ -1670,7 +1669,7 @@ Perl_apply(pTHX_ I32 type, register SV **mark, register SV **sp)
register I32 val;
register I32 val2;
register I32 tot = 0;
- char *what;
+ const char *what;
char *s;
SV **oldmark = mark;
STRLEN n_a;
diff --git a/dump.c b/dump.c
index 0ae1a440dc..8143bfbe71 100644
--- a/dump.c
+++ b/dump.c
@@ -53,17 +53,17 @@ Perl_dump_all(pTHX)
}
void
-Perl_dump_packsubs(pTHX_ HV *stash)
+Perl_dump_packsubs(pTHX_ const HV *stash)
{
I32 i;
- HE *entry;
if (!HvARRAY(stash))
return;
for (i = 0; i <= (I32) HvMAX(stash); i++) {
+ const HE *entry;
for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
- GV *gv = (GV*)HeVAL(entry);
- HV *hv;
+ const GV *gv = (GV*)HeVAL(entry);
+ const HV *hv;
if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv))
continue;
if (GvCVu(gv))
@@ -78,7 +78,7 @@ Perl_dump_packsubs(pTHX_ HV *stash)
}
void
-Perl_dump_sub(pTHX_ GV *gv)
+Perl_dump_sub(pTHX_ const GV *gv)
{
SV *sv = sv_newmortal();
@@ -95,7 +95,7 @@ Perl_dump_sub(pTHX_ GV *gv)
}
void
-Perl_dump_form(pTHX_ GV *gv)
+Perl_dump_form(pTHX_ const GV *gv)
{
SV *sv = sv_newmortal();
@@ -114,15 +114,15 @@ Perl_dump_eval(pTHX)
}
char *
-Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
+Perl_pv_display(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
{
- int truncated = 0;
- int nul_terminated = len > cur && pv[cur] == '\0';
+ const bool nul_terminated = len > cur && pv[cur] == '\0';
+ bool truncated = 0;
sv_setpvn(dsv, "\"", 1);
for (; cur--; pv++) {
if (pvlim && SvCUR(dsv) >= pvlim) {
- truncated++;
+ truncated = 1;
break;
}
switch (*pv) {
@@ -981,7 +981,7 @@ Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxne
{
int n;
- char *name = 0;
+ const char *name = 0;
for (n=0; magic_names[n].name; n++) {
if (mg->mg_type == magic_names[n].type) {
name = magic_names[n].name;
@@ -1056,7 +1056,7 @@ Perl_magic_dump(pTHX_ MAGIC *mg)
}
void
-Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv)
+Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, const char *name, HV *sv)
{
Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && HvNAME(sv))
@@ -1066,7 +1066,7 @@ Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv)
}
void
-Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
+Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv)
{
Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && GvNAME(sv))
@@ -1076,7 +1076,7 @@ Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
}
void
-Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
+Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv)
{
Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && GvNAME(sv)) {
@@ -1093,7 +1093,7 @@ void
Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
{
SV *d;
- char *s;
+ const char *s;
U32 flags;
U32 type;
@@ -1420,7 +1420,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
while ((he = hv_iternext_flags(hv, HV_ITERNEXT_WANTPLACEHOLDERS))
&& count--) {
SV *elt, *keysv;
- char *keypv;
+ const char *keypv;
STRLEN len;
U32 hash = HeHASH(he);
@@ -1463,7 +1463,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
do_dump_pad(level+1, file, CvPADLIST(sv), 0);
}
{
- CV *outside = CvOUTSIDE(sv);
+ const CV *outside = CvOUTSIDE(sv);
Perl_dump_indent(aTHX_ level, file, " OUTSIDE = 0x%"UVxf" (%s)\n",
PTR2UV(outside),
(!outside ? "null"
@@ -1629,7 +1629,7 @@ Perl_debop(pTHX_ OP *o)
STATIC CV*
S_deb_curcv(pTHX_ I32 ix)
{
- PERL_CONTEXT *cx = &cxstack[ix];
+ const PERL_CONTEXT *cx = &cxstack[ix];
if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT)
return cx->blk_sub.cv;
else if (CxTYPE(cx) == CXt_EVAL && !CxTRYBLOCK(cx))
@@ -1652,7 +1652,7 @@ Perl_watch(pTHX_ char **addr)
}
STATIC void
-S_debprof(pTHX_ OP *o)
+S_debprof(pTHX_ const OP *o)
{
if (CopSTASH_eq(PL_curcop, PL_debstash) && !DEBUG_J_TEST_)
return;
diff --git a/embed.fnc b/embed.fnc
index 18d2973dec..5b4719d353 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -47,7 +47,7 @@ Anod |void |perl_free |PerlInterpreter* interp
Anod |int |perl_run |PerlInterpreter* interp
Anod |int |perl_parse |PerlInterpreter* interp|XSINIT_t xsinit \
|int argc|char** argv|char** env
-Anp |bool |doing_taint |int argc|char** argv|char** env
+Anp |bool |doing_taint |int argc|const char** argv|const char** env
#if defined(USE_ITHREADS)
Anod |PerlInterpreter*|perl_clone|PerlInterpreter* interp|UV flags
# if defined(PERL_IMPLICIT_SYS)
@@ -143,9 +143,9 @@ Ap |void |cx_dump |PERL_CONTEXT* cs
Ap |SV* |filter_add |filter_t funcp|SV* datasv
Ap |void |filter_del |filter_t funcp
Ap |I32 |filter_read |int idx|SV* buffer|int maxlen
-Ap |char** |get_op_descs
-Ap |char** |get_op_names
-p |char* |get_no_modify
+Ap |const char** |get_op_descs
+Ap |const char** |get_op_names
+p |const char* |get_no_modify
p |U32* |get_opargs
Ap |PPADDR_t*|get_ppaddr
Ep |I32 |cxinc
@@ -155,8 +155,8 @@ Ap |void |debprofdump
Ap |I32 |debop |OP* o
Ap |I32 |debstack
Ap |I32 |debstackptrs
-Ap |char* |delimcpy |char* to|char* toend|char* from \
- |char* fromend|int delim|I32* retlen
+Ap |char* |delimcpy |char* to|const char* toend|const char* from \
+ |const char* fromend|int delim|I32* retlen
p |void |deprecate |const char* s
p |void |deprecate_old |const char* s
Afp |OP* |die |const char* pat|...
@@ -216,17 +216,17 @@ Ap |void |dump_eval
#if defined(DUMP_FDS)
Ap |void |dump_fds |char* s
#endif
-Ap |void |dump_form |GV* gv
+Ap |void |dump_form |const GV* gv
Ap |void |gv_dump |GV* gv
Ap |void |op_dump |OP* arg
Ap |void |pmop_dump |PMOP* pm
-Ap |void |dump_packsubs |HV* stash
-Ap |void |dump_sub |GV* gv
+Ap |void |dump_packsubs |const HV* stash
+Ap |void |dump_sub |const GV* gv
Apd |void |fbm_compile |SV* sv|U32 flags
Apd |char* |fbm_instr |unsigned char* big|unsigned char* bigend \
|SV* littlesv|U32 flags
-p |char* |find_script |char *scriptname|bool dosearch \
- |char **search_ext|I32 flags
+p |char* |find_script |const char *scriptname|bool dosearch \
+ |const char **search_ext|I32 flags
p |OP* |force_list |OP* arg
p |OP* |fold_constants |OP* arg
Afpd |char* |form |const char* pat|...
@@ -292,7 +292,7 @@ Ap |I32 |ibcmp |const char* a|const char* b|I32 len
Ap |I32 |ibcmp_locale |const char* a|const char* b|I32 len
Apd |I32 |ibcmp_utf8 |const char* a|char **pe1|UV l1|bool u1|const char* b|char **pe2|UV l2|bool u2
p |bool |ingroup |Gid_t testgid|Uid_t effective
-p |void |init_argv_symbols|int|char **
+p |void |init_argv_symbols|int argc|const char **argv
p |void |init_debugger
Ap |void |init_stacks
Ap |void |init_tm |struct tm *ptm
@@ -428,7 +428,7 @@ p |int |magic_setutf8 |SV* sv|MAGIC* mg
p |int |magic_set_all_env|SV* sv|MAGIC* mg
p |U32 |magic_sizepack |SV* sv|MAGIC* mg
p |int |magic_wipepack |SV* sv|MAGIC* mg
-p |void |magicname |char* sym|char* name|I32 namlen
+p |void |magicname |const char* sym|const char* name|I32 namlen
Ap |void |markstack_grow
#if defined(USE_LOCALE_COLLATE)
p |char* |mem_collxfrm |const char* s|STRLEN len|STRLEN* xlen
@@ -474,9 +474,9 @@ Anp |void* |my_memset |char* loc|I32 ch|I32 len
Ap |I32 |my_pclose |PerlIO* ptr
Ap |PerlIO*|my_popen |char* cmd|char* mode
Ap |PerlIO*|my_popen_list |char* mode|int n|SV ** args
-Ap |void |my_setenv |char* nam|char* val
+Ap |void |my_setenv |const char* nam|const char* val
Ap |I32 |my_stat
-Ap |char * |my_strftime |char *fmt|int sec|int min|int hour|int mday|int mon|int year|int wday|int yday|int isdst
+Ap |char * |my_strftime |const char *fmt|int sec|int min|int hour|int mday|int mon|int year|int wday|int yday|int isdst
#if defined(MYSWAP)
Ap |short |my_swap |short s
Ap |long |my_htonl |long l
@@ -488,7 +488,7 @@ Ap |OP* |newANONHASH |OP* o
Ap |OP* |newANONSUB |I32 floor|OP* proto|OP* block
Ap |OP* |newASSIGNOP |I32 flags|OP* left|I32 optype|OP* right
Ap |OP* |newCONDOP |I32 flags|OP* expr|OP* trueop|OP* falseop
-Apd |CV* |newCONSTSUB |HV* stash|char* name|SV* sv
+Apd |CV* |newCONSTSUB |HV* stash|const char* name|SV* sv
Ap |void |newFORM |I32 floor|OP* o|OP* block
Ap |OP* |newFOROP |I32 flags|char* label|line_t forline \
|OP* sclr|OP* expr|OP*block|OP*cont
@@ -508,7 +508,7 @@ Ap |OP* |newAVREF |OP* o
Ap |OP* |newBINOP |I32 type|I32 flags|OP* first|OP* last
Ap |OP* |newCVREF |I32 flags|OP* o
Ap |OP* |newGVOP |I32 type|I32 flags|GV* gv
-Ap |GV* |newGVgen |char* pack
+Ap |GV* |newGVgen |const char* pack
Ap |OP* |newGVREF |I32 type|OP* o
Ap |OP* |newHVREF |OP* o
Apd |HV* |newHV
@@ -539,7 +539,7 @@ Ap |OP* |newWHILEOP |I32 flags|I32 debuggable|LOOP* loop \
Ap |PERL_SI*|new_stackinfo|I32 stitems|I32 cxitems
Ap |char* |scan_vstring |const char *vstr|SV *sv
-Apd |char* |scan_version |char *vstr|SV *sv|bool qv
+Apd |char* |scan_version |const char *vstr|SV *sv|bool qv
Apd |SV* |new_version |SV *ver
Apd |SV* |upg_version |SV *ver
Apd |SV* |vnumify |SV *vs
@@ -554,7 +554,7 @@ Ap |void |op_free |OP* arg
p |void |package |OP* o
pd |PADOFFSET|pad_alloc |I32 optype|U32 tmptype
p |PADOFFSET|allocmy |char* name
-pd |PADOFFSET|pad_findmy |char* name
+pd |PADOFFSET|pad_findmy |const char* name
Ap |PADOFFSET|find_rundefsvoffset |
p |OP* |oopsAV |OP* o
p |OP* |oopsHV |OP* o
@@ -572,7 +572,7 @@ Ap |void |reentrant_free
Anp |void* |reentrant_retry|const char*|...
#endif
Ap |void |call_atexit |ATEXIT_t fn|void *ptr
-Apd |I32 |call_argv |const char* sub_name|I32 flags|char** argv
+Apd |I32 |call_argv |const char* sub_name|I32 flags|const char** argv
Apd |I32 |call_method |const char* methname|I32 flags
Apd |I32 |call_pv |const char* sub_name|I32 flags
Apd |I32 |call_sv |SV* sv|I32 flags
@@ -654,7 +654,7 @@ Ap |void |save_generic_pvref|char** str
Ap |void |save_shared_pvref|char** str
Ap |void |save_gp |GV* gv|I32 empty
Ap |HV* |save_hash |GV* gv
-Ap |void |save_helem |const HV* hv|SV *key|SV **sptr
+Ap |void |save_helem |HV* hv|SV *key|SV **sptr
Ap |void |save_hints
Ap |void |save_hptr |HV** hptr
Ap |void |save_I16 |I16* intp
@@ -689,7 +689,7 @@ p |OP* |scope |OP* o
Ap |char* |screaminstr |SV* bigsv|SV* littlesv|I32 start_shift \
|I32 end_shift|I32 *state|I32 last
#if !defined(VMS)
-p |I32 |setenv_getix |char* nam
+p |I32 |setenv_getix |const char* nam
#endif
p |void |setdefout |GV* gv
p |HEK* |share_hek |const char* sv|I32 len|U32 hash
@@ -748,14 +748,14 @@ Apd |char* |sv_gets |SV* sv|PerlIO* fp|I32 append
Apd |char* |sv_grow |SV* sv|STRLEN newlen
Apd |void |sv_inc |SV* sv
Apd |void |sv_insert |SV* bigsv|STRLEN offset|STRLEN len \
- |char* little|STRLEN littlelen
+ |const char* little|STRLEN littlelen
Apd |int |sv_isa |SV* sv|const char* name
Apd |int |sv_isobject |SV* sv
Apd |STRLEN |sv_len |SV* sv
Apd |STRLEN |sv_len_utf8 |SV* sv
Apd |void |sv_magic |SV* sv|SV* obj|int how|const char* name \
|I32 namlen
-Apd |MAGIC *|sv_magicext |SV* sv|SV* obj|int how|MGVTBL *vtbl \
+Apd |MAGIC *|sv_magicext |SV* sv|SV* obj|int how|const MGVTBL *vtbl \
|const char* name|I32 namlen
Apd |SV* |sv_mortalcopy |SV* oldsv
Apd |SV* |sv_newmortal
@@ -772,7 +772,7 @@ Apd |bool |sv_cat_decode |SV* dsv|SV *encoding|SV *ssv|int *offset \
Apd |const char*|sv_reftype |const SV* sv|int ob
Apd |void |sv_replace |SV* sv|SV* nsv
Apd |void |sv_report_used
-Apd |void |sv_reset |char* s|HV* stash
+Apd |void |sv_reset |const char* s|HV* stash
Afpd |void |sv_setpvf |SV* sv|const char* pat|...
Apd |void |sv_vsetpvf |SV* sv|const char* pat|va_list* args
Apd |void |sv_setiv |SV* sv|IV num
@@ -807,7 +807,7 @@ Ap |SV* |swash_init |const char* pkg|const char* name|SV* listsv|I32 minbits|I32
Ap |UV |swash_fetch |SV *sv|const U8 *ptr|bool do_utf8
Ap |void |taint_env
Ap |void |taint_proper |const char* f|const char* s
-Apd |UV |to_utf8_case |const U8 *p|U8* ustrp|STRLEN *lenp|SV **swash|char *normal|char *special
+Apd |UV |to_utf8_case |const U8 *p|U8* ustrp|STRLEN *lenp|SV **swash|const char *normal|const char *special
Apd |UV |to_utf8_lower |const U8 *p|U8* ustrp|STRLEN *lenp
Apd |UV |to_utf8_upper |const U8 *p|U8* ustrp|STRLEN *lenp
Apd |UV |to_utf8_title |const U8 *p|U8* ustrp|STRLEN *lenp
@@ -826,7 +826,7 @@ Adp |STRLEN |utf8_length |const U8* s|const U8 *e
Apd |IV |utf8_distance |const U8 *a|const U8 *b
Apd |U8* |utf8_hop |U8 *s|I32 off
ApMd |U8* |utf8_to_bytes |U8 *s|STRLEN *len
-ApMd |U8* |bytes_from_utf8|U8 *s|STRLEN *len|bool *is_utf8
+ApMd |U8* |bytes_from_utf8|const U8 *s|STRLEN *len|bool *is_utf8
ApMd |U8* |bytes_to_utf8 |const U8 *s|STRLEN *len
Apd |UV |utf8_to_uvchr |const U8 *s|STRLEN* retlen
Apd |UV |utf8_to_uvuni |const U8 *s|STRLEN* retlen
@@ -836,16 +836,16 @@ Apd |U8* |uvchr_to_utf8 |U8 *d|UV uv
Ap |U8* |uvuni_to_utf8 |U8 *d|UV uv
Ap |U8* |uvchr_to_utf8_flags |U8 *d|UV uv|UV flags
Apd |U8* |uvuni_to_utf8_flags |U8 *d|UV uv|UV flags
-Apd |char* |pv_uni_display |SV *dsv|U8 *spv|STRLEN len \
+Apd |char* |pv_uni_display |SV *dsv|const U8 *spv|STRLEN len \
|STRLEN pvlim|UV flags
Apd |char* |sv_uni_display |SV *dsv|SV *ssv|STRLEN pvlim|UV flags
p |void |vivify_defelem |SV* sv
p |void |vivify_ref |SV* sv|U32 to_what
p |I32 |wait4pid |Pid_t pid|int* statusp|int flags
-p |U32 |parse_unicode_opts|char **popt
+p |U32 |parse_unicode_opts|const char **popt
p |U32 |seed
p |UV |get_hash_seed
-p |void |report_evil_fh |GV *gv|IO *io|I32 op
+p |void |report_evil_fh |const GV *gv|const IO *io|I32 op
pd |void |report_uninit |SV* uninit_sv
Afpd |void |warn |const char* pat|...
Ap |void |vwarn |const char* pat|va_list* args
@@ -887,14 +887,14 @@ Apd |void |sv_setpvn_mg |SV *sv|const char *ptr|STRLEN len
Apd |void |sv_setsv_mg |SV *dstr|SV *sstr
Apd |void |sv_usepvn_mg |SV *sv|char *ptr|STRLEN len
Ap |MGVTBL*|get_vtbl |int vtbl_id
-Ap |char* |pv_display |SV *dsv|char *pv|STRLEN cur|STRLEN len \
+Ap |char* |pv_display |SV *dsv|const char *pv|STRLEN cur|STRLEN len \
|STRLEN pvlim
Afp |void |dump_indent |I32 level|PerlIO *file|const char* pat|...
Ap |void |dump_vindent |I32 level|PerlIO *file|const char* pat \
|va_list *args
-Ap |void |do_gv_dump |I32 level|PerlIO *file|char *name|GV *sv
-Ap |void |do_gvgv_dump |I32 level|PerlIO *file|char *name|GV *sv
-Ap |void |do_hv_dump |I32 level|PerlIO *file|char *name|HV *sv
+Ap |void |do_gv_dump |I32 level|PerlIO *file|const char *name|GV *sv
+Ap |void |do_gvgv_dump |I32 level|PerlIO *file|const char *name|GV *sv
+Ap |void |do_hv_dump |I32 level|PerlIO *file|const char *name|HV *sv
Ap |void |do_magic_dump |I32 level|PerlIO *file|MAGIC *mg|I32 nest \
|I32 maxnest|bool dumpops|STRLEN pvlim
Ap |void |do_op_dump |I32 level|PerlIO *file|OP *o
@@ -951,8 +951,8 @@ Ap |void |sys_intern_clear
Ap |void |sys_intern_init
#endif
-Ap |char * |custom_op_name |OP* op
-Ap |char * |custom_op_desc |OP* op
+Ap |const char *|custom_op_name |const OP* op
+Ap |const char *|custom_op_desc |const OP* op
#if defined(PERL_COPY_ON_WRITE)
pMX |int |sv_release_IVX |SV *sv
@@ -994,8 +994,8 @@ s |void |hv_notallowed |int flags|const char *key|I32 klen|const char *msg
#if defined(PERL_IN_MG_C) || defined(PERL_DECL_PROT)
s |void |save_magic |I32 mgs_ix|SV *sv
-s |int |magic_methpack |SV *sv|MAGIC *mg|char *meth
-s |int |magic_methcall |SV *sv|MAGIC *mg|char *meth|I32 f \
+s |int |magic_methpack |SV *sv|const MAGIC *mg|const char *meth
+s |int |magic_methcall |SV *sv|const MAGIC *mg|const char *meth|I32 f \
|int n|SV *val
#endif
@@ -1027,8 +1027,8 @@ Ap |void |Slab_Free |void *op
#if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
s |void |find_beginning
-s |void |forbid_setid |char *
-s |void |incpush |char *|int|int|int|int
+s |void |forbid_setid |const char * s
+s |void |incpush |const char *|int|int|int|int
s |void |init_interp
s |void |init_ids
s |void |init_lexer
@@ -1039,14 +1039,14 @@ s |void |init_predump_symbols
rs |void |my_exit_jump
s |void |nuke_stacks
s |void |open_script |char *|bool|SV *
-s |void |usage |char *
-s |void |validate_suid |char *|char*
+s |void |usage |const char *
+s |void |validate_suid |const char *validarg|const char *scriptname
# if defined(IAMSUID)
s |int |fd_on_nosuid_fs|int fd
# endif
s |void* |parse_body |char **env|XSINIT_t xsinit
s |void* |run_body |I32 oldscope
-s |void |call_body |OP *myop|int is_eval
+s |void |call_body |const OP *myop|int is_eval
s |void* |call_list_body |CV *cv
#endif
@@ -1160,7 +1160,7 @@ Es |void |to_byte_substr |regexp * prog
#if defined(PERL_IN_DUMP_C) || defined(PERL_DECL_PROT)
s |CV* |deb_curcv |I32 ix
-s |void |debprof |OP *o
+s |void |debprof |const OP *o
#endif
#if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT)
@@ -1351,11 +1351,11 @@ s |void |deb_stack_n |SV** stack_base|I32 stack_min \
pd |PADLIST*|pad_new |int flags
pd |void |pad_undef |CV* cv
-pd |PADOFFSET|pad_add_name |char *name\
+pd |PADOFFSET|pad_add_name |const char *name\
|HV* typestash|HV* ourstash \
|bool clone
pd |PADOFFSET|pad_add_anon |SV* sv|OPCODE op_type
-pd |void |pad_check_dup |char* name|bool is_our|HV* ourstash
+pd |void |pad_check_dup |const char* name|bool is_our|const HV* ourstash
#ifdef DEBUGGING
pd |void |pad_setsv |PADOFFSET po|SV* sv
#endif
@@ -1368,17 +1368,17 @@ pd |void |pad_fixup_inner_anons|PADLIST *padlist|CV *old_cv|CV *new_cv
pd |void |pad_push |PADLIST *padlist|int depth
#if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT)
-sd |PADOFFSET|pad_findlex |char *name|CV* cv|U32 seq|int warn \
+sd |PADOFFSET|pad_findlex |const char *name|const CV* cv|U32 seq|int warn \
|SV** out_capture|SV** out_name_sv \
|int *out_flags
# if defined(DEBUGGING)
-sd |void |cv_dump |CV *cv|char *title
+sd |void |cv_dump |const CV *cv|const char *title
# endif
#endif
pd |CV* |find_runcv |U32 *db_seqp
p |void |free_tied_hv_pool
#if defined(DEBUGGING)
-p |int |get_debug_opts |char **s|bool givehelp
+p |int |get_debug_opts |const char **s|bool givehelp
#endif
Ap |void |save_set_svflags|SV* sv|U32 mask|U32 val
Apod |void |hv_assert |HV* tb
diff --git a/gv.c b/gv.c
index bc141f538f..77d35a71e7 100644
--- a/gv.c
+++ b/gv.c
@@ -106,7 +106,7 @@ void
Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi)
{
register GP *gp;
- bool doproto = SvTYPE(gv) > SVt_NULL;
+ const bool doproto = SvTYPE(gv) > SVt_NULL;
char *proto = (doproto && SvPOK(gv)) ? SvPVX(gv) : NULL;
sv_upgrade((SV*)gv, SVt_PVGV);
@@ -487,7 +487,7 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method)
HV* varstash;
GV* vargv;
SV* varsv;
- char *packname = "";
+ const char *packname = "";
if (len == autolen && strnEQ(name, autoload, autolen))
return Nullgv;
@@ -881,7 +881,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
if ((add & GV_ADDMULTI) && strEQ(nambeg,"AnyDBM_File::ISA")
&& AvFILLp(av) == -1)
{
- char *pname;
+ const char *pname;
av_push(av, newSVpvn(pname = "NDBM_File",9));
gv_stashpvn(pname, 9, TRUE);
av_push(av, newSVpvn(pname = "DB_File",7));
@@ -1167,7 +1167,7 @@ Perl_gv_fullname(pTHX_ SV *sv, const GV *gv)
void
Perl_gv_efullname(pTHX_ SV *sv, const GV *gv)
{
- gv_efullname3(sv, gv, sv == (SV*)gv ? "*" : "");
+ gv_efullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
}
IO *
@@ -1194,7 +1194,6 @@ Perl_newIO(pTHX)
void
Perl_gv_check(pTHX_ HV *stash)
{
- register HE *entry;
register I32 i;
register GV *gv;
HV *hv;
@@ -1202,6 +1201,7 @@ Perl_gv_check(pTHX_ HV *stash)
if (!HvARRAY(stash))
return;
for (i = 0; i <= (I32) HvMAX(stash); i++) {
+ const HE *entry;
for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
(gv = (GV*)HeVAL(entry)) && isGV(gv) && (hv = GvHV(gv)))
@@ -1210,7 +1210,7 @@ Perl_gv_check(pTHX_ HV *stash)
gv_check(hv); /* nested package */
}
else if (isALPHA(*HeKEY(entry))) {
- char *file;
+ const char *file;
gv = (GV*)HeVAL(entry);
if (SvTYPE(gv) != SVt_PVGV || GvMULTI(gv))
continue;
@@ -1243,7 +1243,7 @@ Perl_gv_check(pTHX_ HV *stash)
}
GV *
-Perl_newGVgen(pTHX_ char *pack)
+Perl_newGVgen(pTHX_ const char *pack)
{
return gv_fetchpv(Perl_form(aTHX_ "%s::_GEN_%ld", pack, (long)PL_gensym++),
TRUE, SVt_PVGV);
@@ -1376,10 +1376,10 @@ Perl_Gv_AMupdate(pTHX_ HV *stash)
for (i = 1; i < lim; i++)
amt.table[i] = Nullcv;
for (; i < NofAMmeth; i++) {
- char *cooky = (char*)PL_AMG_names[i];
+ const char *cooky = PL_AMG_names[i];
/* Human-readable form, for debugging: */
- char *cp = (i >= DESTROY_amg ? cooky : AMG_id2name(i));
- STRLEN l = strlen(cooky);
+ const char *cp = (i >= DESTROY_amg ? cooky : AMG_id2name(i));
+ const STRLEN l = strlen(cooky);
DEBUG_o( Perl_deb(aTHX_ "Checking overloading of `%s' in package `%.256s'\n",
cp, HvNAME(stash)) );
@@ -1477,7 +1477,7 @@ Perl_gv_handler(pTHX_ HV *stash, I32 id)
"Inherited AUTOLOAD for a non-method deprecated", since
our caller is going through a function call, not a method call.
So return the CV for AUTOLOAD, setting $AUTOLOAD. */
- GV *gv = gv_fetchmethod(stash, (char*)PL_AMG_names[id]);
+ GV *gv = gv_fetchmethod(stash, PL_AMG_names[id]);
if (gv && GvCV(gv))
return GvCV(gv);
@@ -1843,7 +1843,7 @@ bool
Perl_is_gv_magical_sv(pTHX_ SV *name, U32 flags)
{
STRLEN len;
- char *temp = SvPV(name, len);
+ const char *temp = SvPV(name, len);
return is_gv_magical(temp, len, flags);
}
diff --git a/gv.h b/gv.h
index 30a91147f2..91fbd56b63 100644
--- a/gv.h
+++ b/gv.h
@@ -20,7 +20,7 @@ struct gp {
U32 gp_cvgen; /* generational validity of cached gv_cv */
U32 gp_flags; /* XXX unused */
line_t gp_line; /* line first declared at (for -w) */
- char * gp_file; /* file first declared in (for -w) */
+ const char * gp_file; /* file first declared in (for -w) */
};
#define GvXPVGV(gv) ((XPVGV*)SvANY(gv))
diff --git a/hv.c b/hv.c
index 58fd5fc354..6879e55e6b 100644
--- a/hv.c
+++ b/hv.c
@@ -455,7 +455,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
if (isLOWER(key[i])) {
/* Would be nice if we had a routine to do the
copy and upercase in a single pass through. */
- char *nkey = strupr(savepvn(key,klen));
+ const char *nkey = strupr(savepvn(key,klen));
/* Note that this fetch is for nkey (the uppercased
key) whereas the store is for key (the original) */
entry = hv_fetch_common(hv, Nullsv, nkey, klen,
diff --git a/mg.c b/mg.c
index 6cd1c6fcc3..679c51ea16 100644
--- a/mg.c
+++ b/mg.c
@@ -119,7 +119,7 @@ Turns on the magical status of an SV. See C<sv_magic>.
void
Perl_mg_magical(pTHX_ SV *sv)
{
- MAGIC* mg;
+ const MAGIC* mg;
for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) {
const MGVTBL* const vtbl = mg->mg_virtual;
if (vtbl) {
@@ -231,7 +231,7 @@ Perl_mg_set(pTHX_ SV *sv)
save_magic(mgs_ix, sv);
for (mg = SvMAGIC(sv); mg; mg = nextmg) {
- MGVTBL* vtbl = mg->mg_virtual;
+ const MGVTBL* vtbl = mg->mg_virtual;
nextmg = mg->mg_moremagic; /* it may delete itself */
if (mg->mg_flags & MGf_GSKIP) {
mg->mg_flags &= ~MGf_GSKIP; /* setting requires another read */
@@ -1454,7 +1454,7 @@ Perl_magic_setnkeys(pTHX_ SV *sv, MAGIC *mg)
/* caller is responsible for stack switching/cleanup */
STATIC int
-S_magic_methcall(pTHX_ SV *sv, MAGIC *mg, char *meth, I32 flags, int n, SV *val)
+S_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 flags, int n, SV *val)
{
dSP;
@@ -1481,7 +1481,7 @@ S_magic_methcall(pTHX_ SV *sv, MAGIC *mg, char *meth, I32 flags, int n, SV *val)
}
STATIC int
-S_magic_methpack(pTHX_ SV *sv, MAGIC *mg, char *meth)
+S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, const char *meth)
{
dSP;
@@ -2045,7 +2045,7 @@ Perl_magic_setutf8(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
{
- register char *s;
+ register const char *s;
I32 i;
STRLEN len;
switch (*mg->mg_ptr) {
@@ -2195,12 +2195,12 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
break;
case '^':
Safefree(IoTOP_NAME(GvIOp(PL_defoutgv)));
- IoTOP_NAME(GvIOp(PL_defoutgv)) = s = savesvpv(sv);
+ s = IoTOP_NAME(GvIOp(PL_defoutgv)) = savesvpv(sv);
IoTOP_GV(GvIOp(PL_defoutgv)) = gv_fetchsv(sv,TRUE, SVt_PVIO);
break;
case '~':
Safefree(IoFMT_NAME(GvIOp(PL_defoutgv)));
- IoFMT_NAME(GvIOp(PL_defoutgv)) = s = savesvpv(sv);
+ s = IoFMT_NAME(GvIOp(PL_defoutgv)) = savesvpv(sv);
IoFMT_GV(GvIOp(PL_defoutgv)) = gv_fetchsv(sv,TRUE, SVt_PVIO);
break;
case '=':
@@ -2494,7 +2494,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
I32
Perl_whichsig(pTHX_ const char *sig)
{
- register char **sigv;
+ register const char **sigv;
for (sigv = PL_sig_name; *sigv; sigv++)
if (strEQ(sig,*sigv))
@@ -2675,7 +2675,7 @@ restore_magic(pTHX_ const void *p)
static void
unwind_handler_stack(pTHX_ const void *p)
{
- const U32 flags = *(U32*)p;
+ const U32 flags = *(const U32*)p;
if (flags & 1)
PL_savestack_ix -= 5; /* Unprotect save in progress. */
diff --git a/mg.h b/mg.h
index 844cdbbc47..76903ca4a9 100644
--- a/mg.h
+++ b/mg.h
@@ -25,7 +25,7 @@ struct mgvtbl {
struct magic {
MAGIC* mg_moremagic;
- MGVTBL* mg_virtual; /* pointer to magic functions */
+ const MGVTBL* mg_virtual; /* pointer to magic functions */
U16 mg_private;
char mg_type;
U8 mg_flags;
diff --git a/minimod.pl b/minimod.pl
index 18b9c0748c..39f976395f 100644
--- a/minimod.pl
+++ b/minimod.pl
@@ -65,7 +65,7 @@ sub writemain{
my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s );
print $tail1;
- print "\tchar *file = __FILE__;\n";
+ print "\tconst char file[] = __FILE__;\n";
print "\tdXSUB_SYS;\n" if $] > 5.002;
foreach $_ (@exts){
diff --git a/numeric.c b/numeric.c
index 227540fba5..a6386e85dd 100644
--- a/numeric.c
+++ b/numeric.c
@@ -288,7 +288,7 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) {
}
for (; len-- && *s; s++) {
- hexdigit = strchr((char *) PL_hexdigit, *s);
+ hexdigit = strchr(PL_hexdigit, *s);
if (hexdigit) {
/* Write it in this wonky order with a goto to attempt to get the
compiler to make the common case integer-only loop pretty tight.
@@ -317,7 +317,7 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) {
continue;
}
if (*s == '_' && len && allow_underscores && s[1]
- && (hexdigit = strchr((char *) PL_hexdigit, s[1])))
+ && (hexdigit = strchr(PL_hexdigit, s[1])))
{
--len;
++s;
@@ -843,11 +843,11 @@ char*
Perl_my_atof2(pTHX_ const char* orig, NV* value)
{
NV result[3] = {0.0, 0.0, 0.0};
- char* s = (char*)orig;
+ const char* s = orig;
#ifdef USE_PERL_ATOF
UV accumulator[2] = {0,0}; /* before/after dp */
bool negative = 0;
- char* send = s + strlen(orig) - 1;
+ const char* send = s + strlen(orig) - 1;
bool seen_digit = 0;
I32 exp_adjust[2] = {0,0};
I32 exp_acc[2] = {-1, -1};
@@ -945,7 +945,7 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value)
++exp_acc[seen_dp];
}
}
- else if (!seen_dp && GROK_NUMERIC_RADIX((const char **)&s, send)) {
+ else if (!seen_dp && GROK_NUMERIC_RADIX(&s, send)) {
seen_dp = 1;
if (sig_digits > MAX_SIG_DIGITS) {
++s;
diff --git a/op.c b/op.c
index 551d48bb76..9fa2176216 100644
--- a/op.c
+++ b/op.c
@@ -616,7 +616,7 @@ OP *
Perl_scalarvoid(pTHX_ OP *o)
{
OP *kid;
- char* useless = 0;
+ const char* useless = 0;
SV* sv;
U8 want;
@@ -1765,7 +1765,7 @@ Perl_bind_match(pTHX_ I32 type, OP *left, OP *right)
left->op_type == OP_RV2HV ||
left->op_type == OP_PADAV ||
left->op_type == OP_PADHV)) {
- char *desc = PL_op_desc[(right->op_type == OP_SUBST ||
+ const char *desc = PL_op_desc[(right->op_type == OP_SUBST ||
right->op_type == OP_TRANS)
? right->op_type : OP_MATCH];
const char *sample = ((left->op_type == OP_RV2AV ||
@@ -2343,13 +2343,13 @@ Perl_newBINOP(pTHX_ I32 type, I32 flags, OP *first, OP *last)
static int
uvcompare(const void *a, const void *b)
{
- if (*((UV *)a) < (*(UV *)b))
+ if (*((const UV *)a) < (*(const UV *)b))
return -1;
- if (*((UV *)a) > (*(UV *)b))
+ if (*((const UV *)a) > (*(const UV *)b))
return 1;
- if (*((UV *)a+1) < (*(UV *)b+1))
+ if (*((const UV *)a+1) < (*(const UV *)b+1))
return -1;
- if (*((UV *)a+1) > (*(UV *)b+1))
+ if (*((const UV *)a+1) > (*(const UV *)b+1))
return 1;
return 0;
}
@@ -3392,7 +3392,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
OP *
Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o)
{
- U32 seq = intro_my();
+ const U32 seq = intro_my();
register COP *cop;
NewOp(1101, cop, 1, COP);
@@ -3767,8 +3767,8 @@ Perl_newWHILEOP(pTHX_ I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP *
expr = newUNOP(OP_DEFINED, 0,
newASSIGNOP(0, newDEFSVOP(), 0, expr) );
} else if (expr && (expr->op_flags & OPf_KIDS)) {
- OP *k1 = ((UNOP*)expr)->op_first;
- OP *k2 = (k1) ? k1->op_sibling : NULL;
+ const OP *k1 = ((UNOP*)expr)->op_first;
+ const OP *k2 = (k1) ? k1->op_sibling : NULL;
switch (expr->op_type) {
case OP_NULL:
if (k2 && k2->op_type == OP_READLINE
@@ -4043,7 +4043,7 @@ Perl_cv_ckproto(pTHX_ const CV *cv, const GV *gv, const char *p)
if (name)
Perl_sv_catpvf(aTHX_ msg, " sub %"SVf, name);
if (SvPOK(cv))
- Perl_sv_catpvf(aTHX_ msg, " (%"SVf")", (SV *)cv);
+ Perl_sv_catpvf(aTHX_ msg, " (%"SVf")", (const SV *)cv);
else
Perl_sv_catpv(aTHX_ msg, ": none");
sv_catpv(msg, " vs ");
@@ -4392,7 +4392,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
char *s = strrchr(name, ':');
s = s ? s+1 : name;
if (strEQ(s, "BEGIN")) {
- char *not_safe =
+ const char not_safe[] =
"BEGIN not safe after errors--compilation aborted";
if (PL_in_eval & EVAL_KEEPERR)
Perl_croak(aTHX_ not_safe);
@@ -4534,7 +4534,7 @@ eligible for inlining at compile-time.
*/
CV *
-Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv)
+Perl_newCONSTSUB(pTHX_ HV *stash, const char *name, SV *sv)
{
CV* cv;
@@ -4627,7 +4627,7 @@ Perl_newXS(pTHX_ const char *name, XSUBADDR_t subaddr, const char *filename)
CvXSUB(cv) = subaddr;
if (name) {
- char *s = strrchr(name,':');
+ const char *s = strrchr(name,':');
if (s)
s++;
else
@@ -5120,7 +5120,7 @@ Perl_ck_rvconst(pTHX_ register OP *o)
if (SvROK(kidsv) && SvREADONLY(kidsv)) {
SV *rsv = SvRV(kidsv);
int svtype = SvTYPE(rsv);
- char *badtype = Nullch;
+ const char *badtype = Nullch;
switch (o->op_type) {
case OP_RV2SV:
@@ -5145,7 +5145,7 @@ Perl_ck_rvconst(pTHX_ register OP *o)
return o;
}
if ((PL_hints & HINT_STRICT_REFS) && (kid->op_private & OPpCONST_BARE)) {
- char *badthing = Nullch;
+ const char *badthing = Nullch;
switch (o->op_type) {
case OP_RV2SV:
badthing = "a SCALAR";
@@ -5369,7 +5369,7 @@ Perl_ck_fun(pTHX_ OP *o)
/* is this op a FH constructor? */
if (is_handle_constructor(o,numargs)) {
- char *name = Nullch;
+ const char *name = Nullch;
STRLEN len = 0;
flags = 0;
@@ -5402,7 +5402,7 @@ Perl_ck_fun(pTHX_ OP *o)
name = 0;
if ((op = ((BINOP*)kid)->op_first)) {
SV *tmpstr = Nullsv;
- char *a =
+ const char *a =
kid->op_type == OP_AELEM ?
"[]" : "{}";
if (((op->op_type == OP_RV2AV) ||
@@ -6147,7 +6147,7 @@ Perl_ck_join(pTHX_ OP *o)
if (ckWARN(WARN_SYNTAX)) {
OP *kid = cLISTOPo->op_first->op_sibling;
if (kid && kid->op_type == OP_MATCH) {
- char *pmstr = "STRING";
+ const char *pmstr = "STRING";
if (PM_GETRE(kPMOP))
pmstr = PM_GETRE(kPMOP)->precomp;
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
@@ -7013,9 +7013,9 @@ Perl_peep(pTHX_ register OP *o)
-char* Perl_custom_op_name(pTHX_ OP* o)
+const char* Perl_custom_op_name(pTHX_ const OP* o)
{
- IV index = PTR2IV(o->op_ppaddr);
+ const IV index = PTR2IV(o->op_ppaddr);
SV* keysv;
HE* he;
@@ -7031,9 +7031,9 @@ char* Perl_custom_op_name(pTHX_ OP* o)
return SvPV_nolen(HeVAL(he));
}
-char* Perl_custom_op_desc(pTHX_ OP* o)
+const char* Perl_custom_op_desc(pTHX_ const OP* o)
{
- IV index = PTR2IV(o->op_ppaddr);
+ const IV index = PTR2IV(o->op_ppaddr);
SV* keysv;
HE* he;
diff --git a/pad.c b/pad.c
index 132965d942..3182ac8591 100644
--- a/pad.c
+++ b/pad.c
@@ -132,7 +132,7 @@ can be OR'ed together:
PADLIST *
Perl_pad_new(pTHX_ int flags)
{
- AV *padlist, *padname, *pad, *a0;
+ AV *padlist, *padname, *pad;
ASSERT_CURPAD_LEGAL("pad_new");
@@ -173,7 +173,7 @@ Perl_pad_new(pTHX_ int flags)
* dispensed with eventually ???
*/
- a0 = newAV(); /* will be @_ */
+ AV * const a0 = newAV(); /* will be @_ */
av_extend(a0, 0);
av_store(pad, 0, (SV*)a0);
AvFLAGS(a0) = AVf_REIFY;
@@ -229,7 +229,7 @@ void
Perl_pad_undef(pTHX_ CV* cv)
{
I32 ix;
- PADLIST *padlist = CvPADLIST(cv);
+ const PADLIST *padlist = CvPADLIST(cv);
if (!padlist)
return;
@@ -249,7 +249,7 @@ Perl_pad_undef(pTHX_ CV* cv)
if (!PL_dirty) { /* don't bother during global destruction */
CV *outercv = CvOUTSIDE(cv);
- U32 seq = CvOUTSIDE_SEQ(cv);
+ const U32 seq = CvOUTSIDE_SEQ(cv);
AV *comppad_name = (AV*)AvARRAY(padlist)[0];
SV **namepad = AvARRAY(comppad_name);
AV *comppad = (AV*)AvARRAY(padlist)[1];
@@ -324,7 +324,7 @@ If fake, it means we're cloning an existing entry
*/
PADOFFSET
-Perl_pad_add_name(pTHX_ char *name, HV* typestash, HV* ourstash, bool fake)
+Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake)
{
PADOFFSET offset = pad_alloc(OP_PADSV, SVs_PADMY);
SV* namesv = NEWSV(1102, 0);
@@ -409,7 +409,7 @@ Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype)
}
else {
SV **names = AvARRAY(PL_comppad_name);
- SSize_t names_fill = AvFILLp(PL_comppad_name);
+ const SSize_t names_fill = AvFILLp(PL_comppad_name);
for (;;) {
/*
* "foreach" index vars temporarily become aliases to non-"my"
@@ -489,7 +489,7 @@ C<is_our> indicates that the name to check is an 'our' declaration
/* XXX DAPM integrate this into pad_add_name ??? */
void
-Perl_pad_check_dup(pTHX_ char *name, bool is_our, HV *ourstash)
+Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
{
SV **svp, *sv;
PADOFFSET top, off;
@@ -555,12 +555,12 @@ Returns the offset in the current pad, or NOT_IN_PAD on failure.
*/
PADOFFSET
-Perl_pad_findmy(pTHX_ char *name)
+Perl_pad_findmy(pTHX_ const char *name)
{
SV *out_sv;
int out_flags;
I32 offset;
- AV *nameav;
+ const AV *nameav;
SV **name_svp;
offset = pad_findlex(name, PL_compcv, PL_cop_seqmax, 1,
@@ -575,7 +575,7 @@ Perl_pad_findmy(pTHX_ char *name)
nameav = (AV*)AvARRAY(CvPADLIST(PL_compcv))[0];
name_svp = AvARRAY(nameav);
for (offset = AvFILLp(nameav); offset > 0; offset--) {
- SV *namesv = name_svp[offset];
+ const SV *namesv = name_svp[offset];
if (namesv && namesv != &PL_sv_undef
&& !SvFAKE(namesv)
&& (SvFLAGS(namesv) & SVpad_OUR)
@@ -638,13 +638,13 @@ the parent pad.
STATIC PADOFFSET
-S_pad_findlex(pTHX_ char *name, CV* cv, U32 seq, int warn,
+S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn,
SV** out_capture, SV** out_name_sv, int *out_flags)
{
I32 offset, new_offset;
SV *new_capture;
SV **new_capturep;
- AV *padlist = CvPADLIST(cv);
+ const AV *padlist = CvPADLIST(cv);
*out_flags = 0;
@@ -656,11 +656,11 @@ S_pad_findlex(pTHX_ char *name, CV* cv, U32 seq, int warn,
if (padlist) { /* not an undef CV */
I32 fake_offset = 0;
- AV *nameav = (AV*)AvARRAY(padlist)[0];
+ const AV *nameav = (AV*)AvARRAY(padlist)[0];
SV **name_svp = AvARRAY(nameav);
for (offset = AvFILLp(nameav); offset > 0; offset--) {
- SV *namesv = name_svp[offset];
+ const SV *namesv = name_svp[offset];
if (namesv && namesv != &PL_sv_undef
&& strEQ(SvPVX(namesv), name))
{
@@ -986,13 +986,13 @@ Perl_pad_leavemy(pTHX)
{
I32 off;
SV **svp = AvARRAY(PL_comppad_name);
- SV *sv;
PL_pad_reset_pending = FALSE;
ASSERT_CURPAD_ACTIVE("pad_leavemy");
if (PL_min_intro_pending && PL_comppad_name_fill < PL_min_intro_pending) {
for (off = PL_max_intro_pending; off >= PL_min_intro_pending; off--) {
+ const SV *sv;
if ((sv = svp[off]) && sv != &PL_sv_undef
&& !SvFAKE(sv) && ckWARN_d(WARN_INTERNAL))
Perl_warner(aTHX_ packWARN(WARN_INTERNAL),
@@ -1001,6 +1001,7 @@ Perl_pad_leavemy(pTHX)
}
/* "Deintroduce" my variables that are leaving with this scope. */
for (off = AvFILLp(PL_comppad_name); off > PL_comppad_name_fill; off--) {
+ const SV *sv;
if ((sv = svp[off]) && sv != &PL_sv_undef
&& !SvFAKE(sv) && SvIVX(sv) == PAD_MAX)
{
@@ -1072,8 +1073,6 @@ void
Perl_pad_reset(pTHX)
{
#ifdef USE_BROKEN_PAD_RESET
- register I32 po;
-
if (AvARRAY(PL_comppad) != PL_curpad)
Perl_croak(aTHX_ "panic: pad_reset curpad");
@@ -1085,6 +1084,7 @@ Perl_pad_reset(pTHX)
);
if (!PL_tainting) { /* Can't mix tainted and non-tainted temporaries. */
+ register I32 po;
for (po = AvMAX(PL_comppad); po > PL_padix_floor; po--) {
if (PL_curpad[po] && !SvIMMORTAL(PL_curpad[po]))
SvPADTMP_off(PL_curpad[po]);
@@ -1116,7 +1116,6 @@ void
Perl_pad_tidy(pTHX_ padtidy_type type)
{
PADOFFSET ix;
- CV *cv;
ASSERT_CURPAD_ACTIVE("pad_tidy");
@@ -1130,6 +1129,7 @@ Perl_pad_tidy(pTHX_ padtidy_type type)
*/
if (PL_cv_has_eval || PL_perldb) {
+ const CV *cv;
for (cv = PL_compcv ;cv; cv = CvOUTSIDE(cv)) {
if (cv != PL_compcv && CvCOMPILED(cv))
break; /* no need to mark already-compiled code */
@@ -1251,11 +1251,10 @@ Dump the contents of a padlist
void
Perl_do_dump_pad(pTHX_ I32 level, PerlIO *file, PADLIST *padlist, int full)
{
- AV *pad_name;
- AV *pad;
+ const AV *pad_name;
+ const AV *pad;
SV **pname;
SV **ppad;
- SV *namesv;
I32 ix;
if (!padlist) {
@@ -1271,7 +1270,7 @@ Perl_do_dump_pad(pTHX_ I32 level, PerlIO *file, PADLIST *padlist, int full)
);
for (ix = 1; ix <= AvFILLp(pad_name); ix++) {
- namesv = pname[ix];
+ const SV *namesv = pname[ix];
if (namesv && namesv == &PL_sv_undef) {
namesv = Nullsv;
}
@@ -1321,9 +1320,9 @@ dump the contents of a CV
#ifdef DEBUGGING
STATIC void
-S_cv_dump(pTHX_ CV *cv, char *title)
+S_cv_dump(pTHX_ const CV *cv, const char *title)
{
- CV *outside = CvOUTSIDE(cv);
+ const CV *outside = CvOUTSIDE(cv);
AV* padlist = CvPADLIST(cv);
PerlIO_printf(Perl_debug_log,
@@ -1367,12 +1366,12 @@ Perl_cv_clone(pTHX_ CV *proto)
{
I32 ix;
AV* protopadlist = CvPADLIST(proto);
- AV* protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
- AV* protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
+ const AV* protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
+ const AV* protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
SV** pname = AvARRAY(protopad_name);
SV** ppad = AvARRAY(protopad);
- I32 fname = AvFILLp(protopad_name);
- I32 fpad = AvFILLp(protopad);
+ const I32 fname = AvFILLp(protopad_name);
+ const I32 fpad = AvFILLp(protopad);
AV* comppadlist;
CV* cv;
SV** outpad;
@@ -1450,12 +1449,12 @@ Perl_cv_clone(pTHX_ CV *proto)
}
}
if (!sv) {
- char *name = SvPVX(namesv);
- if (*name == '&')
+ const char sigil = SvPVX(namesv)[0];
+ if (sigil == '&')
sv = SvREFCNT_inc(ppad[ix]);
- else if (*name == '@')
+ else if (sigil == '@')
sv = (SV*)newAV();
- else if (*name == '%')
+ else if (sigil == '%')
sv = (SV*)newHV();
else
sv = NEWSV(0, 0);
@@ -1520,7 +1519,7 @@ Perl_pad_fixup_inner_anons(pTHX_ PADLIST *padlist, CV *old_cv, CV *new_cv)
SV **namepad = AvARRAY(comppad_name);
SV **curpad = AvARRAY(comppad);
for (ix = AvFILLp(comppad_name); ix > 0; ix--) {
- SV *namesv = namepad[ix];
+ const SV *namesv = namepad[ix];
if (namesv && namesv != &PL_sv_undef
&& *SvPVX(namesv) == '&')
{
@@ -1554,7 +1553,7 @@ Perl_pad_push(pTHX_ PADLIST *padlist, int depth)
AV *newpad = newAV();
SV **oldpad = AvARRAY(svp[depth-1]);
I32 ix = AvFILLp((AV*)svp[1]);
- const I32 names_fill = AvFILLp((AV*)svp[0]);
+ const I32 names_fill = AvFILLp((AV*)svp[0]);
SV** names = AvARRAY(svp[0]);
AV *av;
diff --git a/patchlevel.h b/patchlevel.h
index a40682a9d0..430ca08f8b 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -118,7 +118,7 @@ hunk.
#if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
-static char *local_patches[] = {
+static const char *local_patches[] = {
NULL
,"DEVEL22511"
,NULL
diff --git a/perl.c b/perl.c
index 86b7e2aa3d..4b1ee08613 100644
--- a/perl.c
+++ b/perl.c
@@ -359,7 +359,7 @@ perl_destruct(pTHXx)
{
char *s;
if ((s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL"))) {
- int i = atoi(s);
+ const int i = atoi(s);
if (destruct_level < i)
destruct_level = i;
}
@@ -980,7 +980,7 @@ Perl_call_atexit(pTHX_ ATEXIT_t fn, void *ptr)
bytes of stack longer than necessary
*/
STATIC void
-S_procself_val(pTHX_ SV *sv, char *arg0)
+S_procself_val(pTHX_ SV *sv, const char *arg0)
{
char buf[MAXPATHLEN];
int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1);
@@ -1081,7 +1081,7 @@ setuid perl scripts securely.\n");
* the area we are able to modify is limited to the size of
* the original argv[0]. (See below for 'contiguous', though.)
* --jhi */
- char *s = NULL;
+ const char *s = NULL;
int i;
UV mask =
~(UV)(PTRSIZE == 4 ? 3 : PTRSIZE == 8 ? 7 : PTRSIZE == 16 ? 15 : 0);
@@ -1222,13 +1222,13 @@ STATIC void *
S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
{
int argc = PL_origargc;
- char **argv = PL_origargv;
- char *scriptname = NULL;
+ const char **argv = PL_origargv;
+ const char *scriptname = NULL;
VOL bool dosearch = FALSE;
- char *validarg = "";
+ const char *validarg = "";
register SV *sv;
register char *s;
- char *cddir = Nullch;
+ const char *cddir = Nullch;
bool minus_f = FALSE;
PL_fdscript = -1;
@@ -1503,7 +1503,7 @@ print \" \\@INC:\\n @INC\\n\";");
#endif
(s = PerlEnv_getenv("PERL5OPT")))
{
- char *popt = s;
+ const char *popt = s;
while (isSPACE(*s))
s++;
if (*s == '-' && *(s+1) == 'T') {
@@ -1986,7 +1986,7 @@ Performs a callback to the specified Perl sub. See L<perlcall>.
*/
I32
-Perl_call_argv(pTHX_ const char *sub_name, I32 flags, register char **argv)
+Perl_call_argv(pTHX_ const char *sub_name, I32 flags, register const char **argv)
/* See G_* flags in cop.h */
/* null terminated arg list */
@@ -2191,7 +2191,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
}
STATIC void
-S_call_body(pTHX_ OP *myop, int is_eval)
+S_call_body(pTHX_ const OP *myop, int is_eval)
{
if (PL_op == myop) {
if (is_eval)
@@ -2360,7 +2360,7 @@ Perl_require_pv(pTHX_ const char *pv)
}
void
-Perl_magicname(pTHX_ char *sym, char *name, I32 namlen)
+Perl_magicname(pTHX_ const char *sym, const char *name, I32 namlen)
{
register GV *gv;
@@ -2369,7 +2369,7 @@ Perl_magicname(pTHX_ char *sym, char *name, I32 namlen)
}
STATIC void
-S_usage(pTHX_ char *name) /* XXX move this out into a module ? */
+S_usage(pTHX_ const char *name) /* XXX move this out into a module ? */
{
/* This message really ought to be max 23 lines.
* Removed -h because the user already knows that option. Others? */
@@ -2406,7 +2406,7 @@ S_usage(pTHX_ char *name) /* XXX move this out into a module ? */
"\n",
NULL
};
- char **p = usage_msg;
+ const char **p = usage_msg;
PerlIO_printf(PerlIO_stdout(),
"\nUsage: %s [switches] [--] [programfile] [arguments]",
@@ -2420,7 +2420,7 @@ NULL
#ifdef DEBUGGING
int
-Perl_get_debug_opts(pTHX_ char **s, bool givehelp)
+Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
{
static const char *usage_msgd[] = {
" Debugging flag values: (see also -d)",
@@ -2455,7 +2455,7 @@ Perl_get_debug_opts(pTHX_ char **s, bool givehelp)
static const char debopts[] = "psltocPmfrxu HXDSTRJvCAq";
for (; isALNUM(**s); (*s)++) {
- char *d = strchr(debopts,**s);
+ const char *d = strchr(debopts,**s);
if (d)
i |= 1 << (d - debopts);
else if (ckWARN_d(WARN_DEBUGGING))
@@ -2468,7 +2468,7 @@ Perl_get_debug_opts(pTHX_ char **s, bool givehelp)
for (; isALNUM(**s); (*s)++) ;
}
else if (givehelp) {
- char **p = usage_msgd;
+ const char **p = usage_msgd;
while (*p) PerlIO_printf(PerlIO_stdout(), "%s\n", *p++);
}
# ifdef EBCDIC
@@ -2690,7 +2690,7 @@ Perl_moreswitches(pTHX_ char *s)
if (*++s) {
char *start;
SV *sv;
- char *use = "use ";
+ const char *use = "use ";
/* -M-foo == 'no foo' */
if (*s == '-') { use = "no "; ++s; }
sv = newSVpv(use,0);
@@ -3019,10 +3019,10 @@ STATIC void
S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
{
#ifndef IAMSUID
- char *quote;
- char *code;
- char *cpp_discard_flag;
- char *perl;
+ const char *quote;
+ const char *code;
+ const char *cpp_discard_flag;
+ const char *perl;
#endif
PL_fdscript = -1;
@@ -3036,7 +3036,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
PL_origfilename = scriptname = find_script(scriptname, dosearch, NULL, 1);
if (strnEQ(scriptname, "/dev/fd/", 8) && isDIGIT(scriptname[8]) ) {
- char *s = scriptname + 8;
+ const char *s = scriptname + 8;
PL_fdscript = atoi(s);
while (isDIGIT(*s))
s++;
@@ -3318,7 +3318,7 @@ S_fd_on_nosuid_fs(pTHX_ int fd)
#endif /* IAMSUID */
STATIC void
-S_validate_suid(pTHX_ char *validarg, char *scriptname)
+S_validate_suid(pTHX_ const char *validarg, const char *scriptname)
{
#ifdef IAMSUID
/* int which; */
@@ -3812,7 +3812,7 @@ S_init_ids(pTHX)
* before even the options are parsed, so PL_tainting has
* not been initialized properly. */
bool
-Perl_doing_taint(int argc, char *argv[], char *envp[])
+Perl_doing_taint(int argc, const char *argv[], const char *envp[])
{
#ifndef PERL_IMPLICIT_SYS
/* If we have PERL_IMPLICIT_SYS we can't call getuid() et alia
@@ -3845,7 +3845,7 @@ Perl_doing_taint(int argc, char *argv[], char *envp[])
}
STATIC void
-S_forbid_setid(pTHX_ char *s)
+S_forbid_setid(pTHX_ const char *s)
{
#ifdef SETUID_SCRIPTS_ARE_SECURE_NOW
if (PL_euid != PL_uid)
@@ -4020,7 +4020,7 @@ S_init_predump_symbols(pTHX)
}
void
-Perl_init_argv_symbols(pTHX_ register int argc, register char **argv)
+Perl_init_argv_symbols(pTHX_ register int argc, register const char **argv)
{
char *s;
argc--,argv++; /* skip name of script */
@@ -4298,7 +4298,7 @@ S_incpush_if_exists(pTHX_ SV *dir)
}
STATIC void
-S_incpush(pTHX_ char *p, int addsubdirs, int addoldvers, int usesep,
+S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep,
int canrelocate)
{
SV *subdir = Nullsv;
@@ -4313,7 +4313,7 @@ S_incpush(pTHX_ char *p, int addsubdirs, int addoldvers, int usesep,
/* Break at all separators */
while (p && *p) {
SV *libdir = NEWSV(55,0);
- char *s;
+ const char *s;
/* skip any consecutive separators */
if (usesep) {
@@ -4602,7 +4602,7 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList)
int ret;
dJMPENV;
- while (AvFILL(paramList) >= 0) {
+ while (av_len(paramList) >= 0) {
cv = (CV*)av_shift(paramList);
if (PL_savebegin) {
if (paramList == PL_beginav) {
diff --git a/perl.h b/perl.h
index a7281f00a5..5417479ba3 100644
--- a/perl.h
+++ b/perl.h
@@ -3268,10 +3268,10 @@ EXTCONST char PL_uuemap[65]
#ifdef DOINIT
-EXT char *PL_sig_name[] = { SIG_NAME };
+EXT const char *PL_sig_name[] = { SIG_NAME };
EXT int PL_sig_num[] = { SIG_NUM };
#else
-EXT char *PL_sig_name[];
+EXT const char *PL_sig_name[];
EXT int PL_sig_num[];
#endif
@@ -3963,7 +3963,7 @@ enum {
};
#define NofAMmeth max_amg_code
-#define AMG_id2name(id) ((char*)PL_AMG_names[id]+1)
+#define AMG_id2name(id) (PL_AMG_names[id]+1)
#ifdef DOINIT
EXTCONST char * PL_AMG_names[NofAMmeth] = {
diff --git a/perlio.c b/perlio.c
index 30ae8ea2f3..2f5373c20f 100644
--- a/perlio.c
+++ b/perlio.c
@@ -463,10 +463,10 @@ PerlIO_debug(const char *fmt, ...)
}
if (dbg > 0) {
dTHX;
+ const char *s;
#ifdef USE_ITHREADS
/* Use fixed buffer as sv_catpvf etc. needs SVs */
char buffer[1024];
- char *s;
STRLEN len;
s = CopFILE(PL_curcop);
if (!s)
@@ -477,7 +477,6 @@ PerlIO_debug(const char *fmt, ...)
PerlLIO_write(dbg, buffer, strlen(buffer));
#else
SV *sv = newSVpvn("", 0);
- char *s;
STRLEN len;
s = CopFILE(PL_curcop);
if (!s)
diff --git a/perliol.h b/perliol.h
index 47fe6fc679..80e7c7d5da 100644
--- a/perliol.h
+++ b/perliol.h
@@ -15,7 +15,7 @@ struct PerlIO_list_s {
struct _PerlIO_funcs {
Size_t fsize;
- char *name;
+ const char *name;
Size_t size;
U32 kind;
IV (*Pushed) (pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab);
diff --git a/perlvars.h b/perlvars.h
index d57cb28b9d..00b0e1ff38 100644
--- a/perlvars.h
+++ b/perlvars.h
@@ -53,7 +53,7 @@ PERLVAR(Gdollarzero_mutex, perl_mutex) /* Modifying $0 */
#endif
/* This is constant on most architectures, a global on OS/2 */
-PERLVARI(Gsh_path, char *, SH_PATH)/* full path of shell */
+PERLVARI(Gsh_path, const char *, SH_PATH)/* full path of shell */
#ifndef PERL_MICRO
/* If Perl has to ignore SIGPFE, this is its saved state.
diff --git a/perly.c b/perly.c
index 2e8da7529a..75c7ed3d43 100644
--- a/perly.c
+++ b/perly.c
@@ -138,7 +138,7 @@ yysymprint (pTHX_ PerlIO *yyoutput, int yytype, YYSTYPE *yyvaluep)
* meanings as the local vars in yyparse() of the same name */
static void
-yy_stack_print (pTHX_ short *yyss, short *yyssp, YYSTYPE *yyvs, char**yyns)
+yy_stack_print (pTHX_ short *yyss, short *yyssp, YYSTYPE *yyvs, const char**yyns)
{
int i;
int start = 1;
@@ -310,7 +310,7 @@ Perl_yyparse (pTHX)
#ifdef DEBUGGING
/* maintain also a stack of token/rule names for debugging with -Dpv */
- char **yyns, **yynsp;
+ const char **yyns, **yynsp;
SV *yyns_sv;
# define YYPOPSTACK (yyvsp--, yyssp--, yynsp--)
#else
@@ -349,7 +349,7 @@ Perl_yyparse (pTHX)
#ifdef DEBUGGING
yyns_sv = NEWSV(73, YYINITDEPTH * sizeof(char *));
SAVEFREESV(yyns_sv);
- yyns = (char **) SvPVX(yyns_sv);
+ yyns = (const char **) SvPVX(yyns_sv);
yynsp = yyns;
#endif
@@ -393,7 +393,7 @@ Perl_yyparse (pTHX)
yyvs = (YYSTYPE *) SvPVX(yyvs_sv);
#ifdef DEBUGGING
SvGROW(yyns_sv, yystacksize * sizeof(char *));
- yyns = (char **) SvPVX(yyns_sv);
+ yyns = (const char **) SvPVX(yyns_sv);
if (! yyns)
goto yyoverflowlab;
yynsp = yyns + yysize - 1;
@@ -476,7 +476,7 @@ Perl_yyparse (pTHX)
*++yyvsp = yylval;
#ifdef DEBUGGING
- *++yynsp = (char *)(yytname[yytoken]);
+ *++yynsp = (const char *)(yytname[yytoken]);
#endif
@@ -538,7 +538,7 @@ Perl_yyparse (pTHX)
*++yyvsp = yyval;
#ifdef DEBUGGING
- *++yynsp = (char *)(yytname [yyr1[yyn]]);
+ *++yynsp = (const char *)(yytname [yyr1[yyn]]);
#endif
/* Now `shift' the result of the reduction. Determine what state
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index f3cff4668f..da9abe87d6 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -310,7 +310,7 @@ Performs a callback to the specified Perl sub. See L<perlcall>.
NOTE: the perl_ form of this function is deprecated.
- I32 call_argv(const char* sub_name, I32 flags, char** argv)
+ I32 call_argv(const char* sub_name, I32 flags, const char** argv)
=for hackers
Found in file perl.c
@@ -1828,7 +1828,7 @@ is a alpha version). The boolean qv denotes that the version
should be interpreted as if it had multiple decimals, even if
it doesn't.
- char* scan_version(char *vstr, SV *sv, bool qv)
+ char* scan_version(const char *vstr, SV *sv, bool qv)
=for hackers
Found in file util.c
@@ -2187,7 +2187,7 @@ Found in file op.c
Creates a constant sub equivalent to Perl C<sub FOO () { 123 }> which is
eligible for inlining at compile-time.
- CV* newCONSTSUB(HV* stash, char* name, SV* sv)
+ CV* newCONSTSUB(HV* stash, const char* name, SV* sv)
=for hackers
Found in file op.c
@@ -4296,7 +4296,7 @@ Found in file sv.c
Inserts a string at the specified offset/length within the SV. Similar to
the Perl substr() function.
- void sv_insert(SV* bigsv, STRLEN offset, STRLEN len, char* little, STRLEN littlelen)
+ void sv_insert(SV* bigsv, STRLEN offset, STRLEN len, const char* little, STRLEN littlelen)
=for hackers
Found in file sv.c
@@ -4385,7 +4385,7 @@ to contain an C<SV*> and is stored as-is with its REFCNT incremented.
(This is now used as a subroutine by C<sv_magic>.)
- MAGIC * sv_magicext(SV* sv, SV* obj, int how, MGVTBL *vtbl, const char* name, I32 namlen)
+ MAGIC * sv_magicext(SV* sv, SV* obj, int how, const MGVTBL *vtbl, const char* name, I32 namlen)
=for hackers
Found in file sv.c
@@ -4601,7 +4601,7 @@ Found in file sv.c
Underlying implementation for the C<reset> Perl function.
Note that the perl-level function is vaguely deprecated.
- void sv_reset(char* s, HV* stash)
+ void sv_reset(const char* s, HV* stash)
=for hackers
Found in file sv.c
@@ -5169,7 +5169,7 @@ is unchanged. Do nothing if C<is_utf8> points to 0. Sets C<is_utf8> to
NOTE: this function is experimental and may change or be
removed without notice.
- U8* bytes_from_utf8(U8 *s, STRLEN *len, bool *is_utf8)
+ U8* bytes_from_utf8(const U8 *s, STRLEN *len, bool *is_utf8)
=for hackers
Found in file utf8.c
@@ -5268,7 +5268,7 @@ UNI_DISPLAY_BACKSLASH and UNI_DISPLAY_ISPRINT turned on.
The pointer to the PV of the dsv is returned.
- char* pv_uni_display(SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
+ char* pv_uni_display(SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
=for hackers
Found in file utf8.c
@@ -5345,7 +5345,7 @@ Perl_to_utf8_case().
The "normal" is a string like "ToLower" which means the swash
%utf8::ToLower.
- UV to_utf8_case(const U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special)
+ UV to_utf8_case(const U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, const char *normal, const char *special)
=for hackers
Found in file utf8.c
diff --git a/pod/perlintern.pod b/pod/perlintern.pod
index 1d04a5dc8f..6ff01563a9 100644
--- a/pod/perlintern.pod
+++ b/pod/perlintern.pod
@@ -540,7 +540,7 @@ Found in file pad.c
dump the contents of a CV
- void cv_dump(CV *cv, char *title)
+ void cv_dump(const CV *cv, const char *title)
=for hackers
Found in file pad.c
@@ -583,7 +583,7 @@ GvSTASH to that value
If fake, it means we're cloning an existing entry
- PADOFFSET pad_add_name(char *name, HV* typestash, HV* ourstash, bool clone)
+ PADOFFSET pad_add_name(const char *name, HV* typestash, HV* ourstash, bool clone)
=for hackers
Found in file pad.c
@@ -616,7 +616,7 @@ Check for duplicate declarations: report any of:
as C<ourstash>
C<is_our> indicates that the name to check is an 'our' declaration
- void pad_check_dup(char* name, bool is_our, HV* ourstash)
+ void pad_check_dup(const char* name, bool is_our, const HV* ourstash)
=for hackers
Found in file pad.c
@@ -640,7 +640,7 @@ then comes back down, adding fake entries as it goes. It has to be this way
because fake namesvs in anon protoypes have to store in NVX the index into
the parent pad.
- PADOFFSET pad_findlex(char *name, CV* cv, U32 seq, int warn, SV** out_capture, SV** out_name_sv, int *out_flags)
+ PADOFFSET pad_findlex(const char *name, const CV* cv, U32 seq, int warn, SV** out_capture, SV** out_name_sv, int *out_flags)
=for hackers
Found in file pad.c
@@ -653,7 +653,7 @@ the complications introduced by eval). If the name is found in an outer pad,
then a fake entry is added to the current pad.
Returns the offset in the current pad, or NOT_IN_PAD on failure.
- PADOFFSET pad_findmy(char* name)
+ PADOFFSET pad_findmy(const char* name)
=for hackers
Found in file pad.c
diff --git a/pp.c b/pp.c
index 7185f0312c..37b0c31a9b 100644
--- a/pp.c
+++ b/pp.c
@@ -159,7 +159,7 @@ PP(pp_rv2gv)
if (SvREADONLY(sv))
Perl_croak(aTHX_ PL_no_modify);
if (PL_op->op_private & OPpDEREF) {
- char *name;
+ const char *name;
GV *gv;
if (cUNOP->op_targ) {
STRLEN len;
@@ -502,7 +502,7 @@ PP(pp_ref)
{
dSP; dTARGET;
SV *sv;
- char *pv;
+ const char *pv;
sv = POPs;
@@ -528,7 +528,7 @@ PP(pp_bless)
else {
SV *ssv = POPs;
STRLEN len;
- char *ptr;
+ const char *ptr;
if (ssv && !SvGMAGICAL(ssv) && !SvAMAGIC(ssv) && SvROK(ssv))
Perl_croak(aTHX_ "Attempt to bless into a reference");
@@ -548,7 +548,7 @@ PP(pp_gelem)
GV *gv;
SV *sv;
SV *tmpRef;
- char *elem;
+ const char *elem;
dSP;
STRLEN n_a;
@@ -597,7 +597,7 @@ PP(pp_gelem)
break;
case 'P':
if (strEQ(elem2, "ACKAGE")) {
- char *name = HvNAME(GvSTASH(gv));
+ const char *name = HvNAME(GvSTASH(gv));
sv = newSVpv(name ? name : "__ANON__", 0);
}
break;
@@ -2995,11 +2995,11 @@ PP(pp_substr)
I32 pos;
I32 rem;
I32 fail;
- I32 lvalue = PL_op->op_flags & OPf_MOD || LVRET;
- char *tmps;
- I32 arybase = PL_curcop->cop_arybase;
+ const I32 lvalue = PL_op->op_flags & OPf_MOD || LVRET;
+ const char *tmps;
+ const I32 arybase = PL_curcop->cop_arybase;
SV *repl_sv = NULL;
- char *repl = 0;
+ const char *repl = 0;
STRLEN repl_len;
int num_args = PL_op->op_private & 7;
bool repl_need_utf8_upgrade = FALSE;
diff --git a/pp_hot.c b/pp_hot.c
index 99c6aff786..0b0e76e0e3 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1840,7 +1840,7 @@ PP(pp_iter)
/* string increment */
register SV* cur = cx->blk_loop.iterlval;
STRLEN maxlen = 0;
- char *max = SvOK((SV*)av) ? SvPV((SV*)av, maxlen) : "";
+ const char *max = SvOK((SV*)av) ? SvPV((SV*)av, maxlen) : "";
if (!SvNIOK(cur) && SvCUR(cur) <= maxlen) {
if (SvREFCNT(*itersvp) == 1 && !SvMAGICAL(*itersvp)) {
/* safe to reuse old SV */
@@ -2885,8 +2885,8 @@ PP(pp_aelem)
SV* elemsv = POPs;
IV elem = SvIV(elemsv);
AV* av = (AV*)POPs;
- U32 lval = PL_op->op_flags & OPf_MOD || LVRET;
- U32 defer = (PL_op->op_private & OPpLVAL_DEFER) && (elem > AvFILL(av));
+ const U32 lval = PL_op->op_flags & OPf_MOD || LVRET;
+ const U32 defer = (PL_op->op_private & OPpLVAL_DEFER) && (elem > av_len(av));
SV *sv;
if (SvROK(elemsv) && !SvGAMAGIC(elemsv) && ckWARN(WARN_MISC))
diff --git a/pp_sys.c b/pp_sys.c
index 12c3684167..f96800ac02 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -322,7 +322,7 @@ PP(pp_backtick)
STRLEN n_a;
char *tmps = POPpx;
I32 gimme = GIMME_V;
- char *mode = "r";
+ const char *mode = "r";
TAINT_PROPER("``");
if (PL_op->op_private & OPpOPEN_IN_RAW)
@@ -331,7 +331,7 @@ PP(pp_backtick)
mode = "rt";
fp = PerlProc_popen(tmps, mode);
if (fp) {
- char *type = NULL;
+ const char *type = NULL;
if (PL_curcop->cop_io) {
type = SvPV_nolen(PL_curcop->cop_io);
}
@@ -433,7 +433,7 @@ PP(pp_warn)
{
dSP; dMARK;
SV *tmpsv;
- char *tmps;
+ const char *tmps;
STRLEN len;
if (SP - MARK != 1) {
dTARGET;
@@ -463,7 +463,7 @@ PP(pp_warn)
PP(pp_die)
{
dSP; dMARK;
- char *tmps;
+ const char *tmps;
SV *tmpsv;
STRLEN len;
bool multiarg = 0;
@@ -790,7 +790,7 @@ PP(pp_tie)
GV *gv;
SV *sv;
I32 markoff = MARK - PL_stack_base;
- char *methname;
+ const char *methname;
int how = PERL_MAGIC_tied;
U32 items;
@@ -2200,7 +2200,7 @@ PP(pp_ioctl)
dSP; dTARGET;
SV *argsv = POPs;
unsigned int func = POPu;
- int optype = PL_op->op_type;
+ const int optype = PL_op->op_type;
char *s;
IV retval;
GV *gv = (GV*)POPs;
diff --git a/proto.h b/proto.h
index 8e91ccd8f1..cb8d8822d5 100644
--- a/proto.h
+++ b/proto.h
@@ -26,7 +26,7 @@ PERL_CALLCONV int perl_destruct(PerlInterpreter* interp);
PERL_CALLCONV void perl_free(PerlInterpreter* interp);
PERL_CALLCONV int perl_run(PerlInterpreter* interp);
PERL_CALLCONV int perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env);
-PERL_CALLCONV bool Perl_doing_taint(int argc, char** argv, char** env);
+PERL_CALLCONV bool Perl_doing_taint(int argc, const char** argv, const char** env);
#if defined(USE_ITHREADS)
PERL_CALLCONV PerlInterpreter* perl_clone(PerlInterpreter* interp, UV flags);
# if defined(PERL_IMPLICIT_SYS)
@@ -132,9 +132,9 @@ PERL_CALLCONV void Perl_cx_dump(pTHX_ PERL_CONTEXT* cs);
PERL_CALLCONV SV* Perl_filter_add(pTHX_ filter_t funcp, SV* datasv);
PERL_CALLCONV void Perl_filter_del(pTHX_ filter_t funcp);
PERL_CALLCONV I32 Perl_filter_read(pTHX_ int idx, SV* buffer, int maxlen);
-PERL_CALLCONV char** Perl_get_op_descs(pTHX);
-PERL_CALLCONV char** Perl_get_op_names(pTHX);
-PERL_CALLCONV char* Perl_get_no_modify(pTHX);
+PERL_CALLCONV const char** Perl_get_op_descs(pTHX);
+PERL_CALLCONV const char** Perl_get_op_names(pTHX);
+PERL_CALLCONV const char* Perl_get_no_modify(pTHX);
PERL_CALLCONV U32* Perl_get_opargs(pTHX);
PERL_CALLCONV PPADDR_t* Perl_get_ppaddr(pTHX);
PERL_CALLCONV I32 Perl_cxinc(pTHX);
@@ -145,7 +145,7 @@ PERL_CALLCONV void Perl_debprofdump(pTHX);
PERL_CALLCONV I32 Perl_debop(pTHX_ OP* o);
PERL_CALLCONV I32 Perl_debstack(pTHX);
PERL_CALLCONV I32 Perl_debstackptrs(pTHX);
-PERL_CALLCONV char* Perl_delimcpy(pTHX_ char* to, char* toend, char* from, char* fromend, int delim, I32* retlen);
+PERL_CALLCONV char* Perl_delimcpy(pTHX_ char* to, const char* toend, const char* from, const char* fromend, int delim, I32* retlen);
PERL_CALLCONV void Perl_deprecate(pTHX_ const char* s);
PERL_CALLCONV void Perl_deprecate_old(pTHX_ const char* s);
PERL_CALLCONV OP* Perl_die(pTHX_ const char* pat, ...)
@@ -201,15 +201,15 @@ PERL_CALLCONV void Perl_dump_eval(pTHX);
#if defined(DUMP_FDS)
PERL_CALLCONV void Perl_dump_fds(pTHX_ char* s);
#endif
-PERL_CALLCONV void Perl_dump_form(pTHX_ GV* gv);
+PERL_CALLCONV void Perl_dump_form(pTHX_ const GV* gv);
PERL_CALLCONV void Perl_gv_dump(pTHX_ GV* gv);
PERL_CALLCONV void Perl_op_dump(pTHX_ OP* arg);
PERL_CALLCONV void Perl_pmop_dump(pTHX_ PMOP* pm);
-PERL_CALLCONV void Perl_dump_packsubs(pTHX_ HV* stash);
-PERL_CALLCONV void Perl_dump_sub(pTHX_ GV* gv);
+PERL_CALLCONV void Perl_dump_packsubs(pTHX_ const HV* stash);
+PERL_CALLCONV void Perl_dump_sub(pTHX_ const GV* gv);
PERL_CALLCONV void Perl_fbm_compile(pTHX_ SV* sv, U32 flags);
PERL_CALLCONV char* Perl_fbm_instr(pTHX_ unsigned char* big, unsigned char* bigend, SV* littlesv, U32 flags);
-PERL_CALLCONV char* Perl_find_script(pTHX_ char *scriptname, bool dosearch, char **search_ext, I32 flags);
+PERL_CALLCONV char* Perl_find_script(pTHX_ const char *scriptname, bool dosearch, const char **search_ext, I32 flags);
PERL_CALLCONV OP* Perl_force_list(pTHX_ OP* arg);
PERL_CALLCONV OP* Perl_fold_constants(pTHX_ OP* arg);
PERL_CALLCONV char* Perl_form(pTHX_ const char* pat, ...)
@@ -269,7 +269,7 @@ PERL_CALLCONV I32 Perl_ibcmp(pTHX_ const char* a, const char* b, I32 len);
PERL_CALLCONV I32 Perl_ibcmp_locale(pTHX_ const char* a, const char* b, I32 len);
PERL_CALLCONV I32 Perl_ibcmp_utf8(pTHX_ const char* a, char **pe1, UV l1, bool u1, const char* b, char **pe2, UV l2, bool u2);
PERL_CALLCONV bool Perl_ingroup(pTHX_ Gid_t testgid, Uid_t effective);
-PERL_CALLCONV void Perl_init_argv_symbols(pTHX_ int, char **);
+PERL_CALLCONV void Perl_init_argv_symbols(pTHX_ int argc, const char **argv);
PERL_CALLCONV void Perl_init_debugger(pTHX);
PERL_CALLCONV void Perl_init_stacks(pTHX);
PERL_CALLCONV void Perl_init_tm(pTHX_ struct tm *ptm);
@@ -405,7 +405,7 @@ PERL_CALLCONV int Perl_magic_setutf8(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_set_all_env(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV U32 Perl_magic_sizepack(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_wipepack(pTHX_ SV* sv, MAGIC* mg);
-PERL_CALLCONV void Perl_magicname(pTHX_ char* sym, char* name, I32 namlen);
+PERL_CALLCONV void Perl_magicname(pTHX_ const char* sym, const char* name, I32 namlen);
PERL_CALLCONV void Perl_markstack_grow(pTHX);
#if defined(USE_LOCALE_COLLATE)
PERL_CALLCONV char* Perl_mem_collxfrm(pTHX_ const char* s, STRLEN len, STRLEN* xlen);
@@ -452,9 +452,9 @@ PERL_CALLCONV void* Perl_my_memset(char* loc, I32 ch, I32 len);
PERL_CALLCONV I32 Perl_my_pclose(pTHX_ PerlIO* ptr);
PERL_CALLCONV PerlIO* Perl_my_popen(pTHX_ char* cmd, char* mode);
PERL_CALLCONV PerlIO* Perl_my_popen_list(pTHX_ char* mode, int n, SV ** args);
-PERL_CALLCONV void Perl_my_setenv(pTHX_ char* nam, char* val);
+PERL_CALLCONV void Perl_my_setenv(pTHX_ const char* nam, const char* val);
PERL_CALLCONV I32 Perl_my_stat(pTHX);
-PERL_CALLCONV char * Perl_my_strftime(pTHX_ char *fmt, int sec, int min, int hour, int mday, int mon, int year, int wday, int yday, int isdst);
+PERL_CALLCONV char * Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, int mon, int year, int wday, int yday, int isdst);
#if defined(MYSWAP)
PERL_CALLCONV short Perl_my_swap(pTHX_ short s);
PERL_CALLCONV long Perl_my_htonl(pTHX_ long l);
@@ -466,7 +466,7 @@ PERL_CALLCONV OP* Perl_newANONHASH(pTHX_ OP* o);
PERL_CALLCONV OP* Perl_newANONSUB(pTHX_ I32 floor, OP* proto, OP* block);
PERL_CALLCONV OP* Perl_newASSIGNOP(pTHX_ I32 flags, OP* left, I32 optype, OP* right);
PERL_CALLCONV OP* Perl_newCONDOP(pTHX_ I32 flags, OP* expr, OP* trueop, OP* falseop);
-PERL_CALLCONV CV* Perl_newCONSTSUB(pTHX_ HV* stash, char* name, SV* sv);
+PERL_CALLCONV CV* Perl_newCONSTSUB(pTHX_ HV* stash, const char* name, SV* sv);
PERL_CALLCONV void Perl_newFORM(pTHX_ I32 floor, OP* o, OP* block);
PERL_CALLCONV OP* Perl_newFOROP(pTHX_ I32 flags, char* label, line_t forline, OP* sclr, OP* expr, OP*block, OP*cont);
PERL_CALLCONV OP* Perl_newLOGOP(pTHX_ I32 optype, I32 flags, OP* left, OP* right);
@@ -485,7 +485,7 @@ PERL_CALLCONV OP* Perl_newAVREF(pTHX_ OP* o);
PERL_CALLCONV OP* Perl_newBINOP(pTHX_ I32 type, I32 flags, OP* first, OP* last);
PERL_CALLCONV OP* Perl_newCVREF(pTHX_ I32 flags, OP* o);
PERL_CALLCONV OP* Perl_newGVOP(pTHX_ I32 type, I32 flags, GV* gv);
-PERL_CALLCONV GV* Perl_newGVgen(pTHX_ char* pack);
+PERL_CALLCONV GV* Perl_newGVgen(pTHX_ const char* pack);
PERL_CALLCONV OP* Perl_newGVREF(pTHX_ I32 type, OP* o);
PERL_CALLCONV OP* Perl_newHVREF(pTHX_ OP* o);
PERL_CALLCONV HV* Perl_newHV(pTHX);
@@ -516,7 +516,7 @@ PERL_CALLCONV OP* Perl_newWHILEOP(pTHX_ I32 flags, I32 debuggable, LOOP* loop, I
PERL_CALLCONV PERL_SI* Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems);
PERL_CALLCONV char* Perl_scan_vstring(pTHX_ const char *vstr, SV *sv);
-PERL_CALLCONV char* Perl_scan_version(pTHX_ char *vstr, SV *sv, bool qv);
+PERL_CALLCONV char* Perl_scan_version(pTHX_ const char *vstr, SV *sv, bool qv);
PERL_CALLCONV SV* Perl_new_version(pTHX_ SV *ver);
PERL_CALLCONV SV* Perl_upg_version(pTHX_ SV *ver);
PERL_CALLCONV SV* Perl_vnumify(pTHX_ SV *vs);
@@ -530,7 +530,7 @@ PERL_CALLCONV void Perl_op_free(pTHX_ OP* arg);
PERL_CALLCONV void Perl_package(pTHX_ OP* o);
PERL_CALLCONV PADOFFSET Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype);
PERL_CALLCONV PADOFFSET Perl_allocmy(pTHX_ char* name);
-PERL_CALLCONV PADOFFSET Perl_pad_findmy(pTHX_ char* name);
+PERL_CALLCONV PADOFFSET Perl_pad_findmy(pTHX_ const char* name);
PERL_CALLCONV PADOFFSET Perl_find_rundefsvoffset(pTHX);
PERL_CALLCONV OP* Perl_oopsAV(pTHX_ OP* o);
PERL_CALLCONV OP* Perl_oopsHV(pTHX_ OP* o);
@@ -548,7 +548,7 @@ PERL_CALLCONV void Perl_reentrant_free(pTHX);
PERL_CALLCONV void* Perl_reentrant_retry(const char*, ...);
#endif
PERL_CALLCONV void Perl_call_atexit(pTHX_ ATEXIT_t fn, void *ptr);
-PERL_CALLCONV I32 Perl_call_argv(pTHX_ const char* sub_name, I32 flags, char** argv);
+PERL_CALLCONV I32 Perl_call_argv(pTHX_ const char* sub_name, I32 flags, const char** argv);
PERL_CALLCONV I32 Perl_call_method(pTHX_ const char* methname, I32 flags);
PERL_CALLCONV I32 Perl_call_pv(pTHX_ const char* sub_name, I32 flags);
PERL_CALLCONV I32 Perl_call_sv(pTHX_ SV* sv, I32 flags);
@@ -623,7 +623,7 @@ PERL_CALLCONV void Perl_save_generic_pvref(pTHX_ char** str);
PERL_CALLCONV void Perl_save_shared_pvref(pTHX_ char** str);
PERL_CALLCONV void Perl_save_gp(pTHX_ GV* gv, I32 empty);
PERL_CALLCONV HV* Perl_save_hash(pTHX_ GV* gv);
-PERL_CALLCONV void Perl_save_helem(pTHX_ const HV* hv, SV *key, SV **sptr);
+PERL_CALLCONV void Perl_save_helem(pTHX_ HV* hv, SV *key, SV **sptr);
PERL_CALLCONV void Perl_save_hints(pTHX);
PERL_CALLCONV void Perl_save_hptr(pTHX_ HV** hptr);
PERL_CALLCONV void Perl_save_I16(pTHX_ I16* intp);
@@ -657,7 +657,7 @@ PERL_CALLCONV NV Perl_scan_oct(pTHX_ char* start, STRLEN len, STRLEN* retlen);
PERL_CALLCONV OP* Perl_scope(pTHX_ OP* o);
PERL_CALLCONV char* Perl_screaminstr(pTHX_ SV* bigsv, SV* littlesv, I32 start_shift, I32 end_shift, I32 *state, I32 last);
#if !defined(VMS)
-PERL_CALLCONV I32 Perl_setenv_getix(pTHX_ char* nam);
+PERL_CALLCONV I32 Perl_setenv_getix(pTHX_ const char* nam);
#endif
PERL_CALLCONV void Perl_setdefout(pTHX_ GV* gv);
PERL_CALLCONV HEK* Perl_share_hek(pTHX_ const char* sv, I32 len, U32 hash);
@@ -716,13 +716,13 @@ PERL_CALLCONV void Perl_sv_free_arenas(pTHX);
PERL_CALLCONV char* Perl_sv_gets(pTHX_ SV* sv, PerlIO* fp, I32 append);
PERL_CALLCONV char* Perl_sv_grow(pTHX_ SV* sv, STRLEN newlen);
PERL_CALLCONV void Perl_sv_inc(pTHX_ SV* sv);
-PERL_CALLCONV void Perl_sv_insert(pTHX_ SV* bigsv, STRLEN offset, STRLEN len, char* little, STRLEN littlelen);
+PERL_CALLCONV void Perl_sv_insert(pTHX_ SV* bigsv, STRLEN offset, STRLEN len, const char* little, STRLEN littlelen);
PERL_CALLCONV int Perl_sv_isa(pTHX_ SV* sv, const char* name);
PERL_CALLCONV int Perl_sv_isobject(pTHX_ SV* sv);
PERL_CALLCONV STRLEN Perl_sv_len(pTHX_ SV* sv);
PERL_CALLCONV STRLEN Perl_sv_len_utf8(pTHX_ SV* sv);
PERL_CALLCONV void Perl_sv_magic(pTHX_ SV* sv, SV* obj, int how, const char* name, I32 namlen);
-PERL_CALLCONV MAGIC * Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, MGVTBL *vtbl, const char* name, I32 namlen);
+PERL_CALLCONV MAGIC * Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, const MGVTBL *vtbl, const char* name, I32 namlen);
PERL_CALLCONV SV* Perl_sv_mortalcopy(pTHX_ SV* oldsv);
PERL_CALLCONV SV* Perl_sv_newmortal(pTHX);
PERL_CALLCONV SV* Perl_sv_newref(pTHX_ SV* sv);
@@ -737,7 +737,7 @@ PERL_CALLCONV bool Perl_sv_cat_decode(pTHX_ SV* dsv, SV *encoding, SV *ssv, int
PERL_CALLCONV const char* Perl_sv_reftype(pTHX_ const SV* sv, int ob);
PERL_CALLCONV void Perl_sv_replace(pTHX_ SV* sv, SV* nsv);
PERL_CALLCONV void Perl_sv_report_used(pTHX);
-PERL_CALLCONV void Perl_sv_reset(pTHX_ char* s, HV* stash);
+PERL_CALLCONV void Perl_sv_reset(pTHX_ const char* s, HV* stash);
PERL_CALLCONV void Perl_sv_setpvf(pTHX_ SV* sv, const char* pat, ...)
__attribute__format__(__printf__,pTHX_2,pTHX_3);
PERL_CALLCONV void Perl_sv_vsetpvf(pTHX_ SV* sv, const char* pat, va_list* args);
@@ -768,7 +768,7 @@ PERL_CALLCONV SV* Perl_swash_init(pTHX_ const char* pkg, const char* name, SV* l
PERL_CALLCONV UV Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8);
PERL_CALLCONV void Perl_taint_env(pTHX);
PERL_CALLCONV void Perl_taint_proper(pTHX_ const char* f, const char* s);
-PERL_CALLCONV UV Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special);
+PERL_CALLCONV UV Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, const char *normal, const char *special);
PERL_CALLCONV UV Perl_to_utf8_lower(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_title(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
@@ -787,7 +787,7 @@ PERL_CALLCONV STRLEN Perl_utf8_length(pTHX_ const U8* s, const U8 *e);
PERL_CALLCONV IV Perl_utf8_distance(pTHX_ const U8 *a, const U8 *b);
PERL_CALLCONV U8* Perl_utf8_hop(pTHX_ U8 *s, I32 off);
PERL_CALLCONV U8* Perl_utf8_to_bytes(pTHX_ U8 *s, STRLEN *len);
-PERL_CALLCONV U8* Perl_bytes_from_utf8(pTHX_ U8 *s, STRLEN *len, bool *is_utf8);
+PERL_CALLCONV U8* Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8);
PERL_CALLCONV U8* Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *len);
PERL_CALLCONV UV Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN* retlen);
PERL_CALLCONV UV Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN* retlen);
@@ -797,15 +797,15 @@ PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv);
PERL_CALLCONV U8* Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv);
PERL_CALLCONV U8* Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags);
PERL_CALLCONV U8* Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags);
-PERL_CALLCONV char* Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags);
+PERL_CALLCONV char* Perl_pv_uni_display(pTHX_ SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV flags);
PERL_CALLCONV char* Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags);
PERL_CALLCONV void Perl_vivify_defelem(pTHX_ SV* sv);
PERL_CALLCONV void Perl_vivify_ref(pTHX_ SV* sv, U32 to_what);
PERL_CALLCONV I32 Perl_wait4pid(pTHX_ Pid_t pid, int* statusp, int flags);
-PERL_CALLCONV U32 Perl_parse_unicode_opts(pTHX_ char **popt);
+PERL_CALLCONV U32 Perl_parse_unicode_opts(pTHX_ const char **popt);
PERL_CALLCONV U32 Perl_seed(pTHX);
PERL_CALLCONV UV Perl_get_hash_seed(pTHX);
-PERL_CALLCONV void Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op);
+PERL_CALLCONV void Perl_report_evil_fh(pTHX_ const GV *gv, const IO *io, I32 op);
PERL_CALLCONV void Perl_report_uninit(pTHX_ SV* uninit_sv);
PERL_CALLCONV void Perl_warn(pTHX_ const char* pat, ...)
__attribute__format__(__printf__,pTHX_1,pTHX_2);
@@ -851,13 +851,13 @@ PERL_CALLCONV void Perl_sv_setpvn_mg(pTHX_ SV *sv, const char *ptr, STRLEN len);
PERL_CALLCONV void Perl_sv_setsv_mg(pTHX_ SV *dstr, SV *sstr);
PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len);
PERL_CALLCONV MGVTBL* Perl_get_vtbl(pTHX_ int vtbl_id);
-PERL_CALLCONV char* Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim);
+PERL_CALLCONV char* Perl_pv_display(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim);
PERL_CALLCONV void Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
__attribute__format__(__printf__,pTHX_3,pTHX_4);
PERL_CALLCONV void Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args);
-PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv);
-PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv);
-PERL_CALLCONV void Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv);
+PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv);
+PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv);
+PERL_CALLCONV void Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, const char *name, HV *sv);
PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o);
PERL_CALLCONV void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP *pm);
@@ -911,8 +911,8 @@ PERL_CALLCONV void Perl_sys_intern_clear(pTHX);
PERL_CALLCONV void Perl_sys_intern_init(pTHX);
#endif
-PERL_CALLCONV char * Perl_custom_op_name(pTHX_ OP* op);
-PERL_CALLCONV char * Perl_custom_op_desc(pTHX_ OP* op);
+PERL_CALLCONV const char * Perl_custom_op_name(pTHX_ const OP* op);
+PERL_CALLCONV const char * Perl_custom_op_desc(pTHX_ const OP* op);
#if defined(PERL_COPY_ON_WRITE)
PERL_CALLCONV int Perl_sv_release_IVX(pTHX_ SV *sv);
@@ -954,8 +954,8 @@ STATIC void S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen, const ch
#if defined(PERL_IN_MG_C) || defined(PERL_DECL_PROT)
STATIC void S_save_magic(pTHX_ I32 mgs_ix, SV *sv);
-STATIC int S_magic_methpack(pTHX_ SV *sv, MAGIC *mg, char *meth);
-STATIC int S_magic_methcall(pTHX_ SV *sv, MAGIC *mg, char *meth, I32 f, int n, SV *val);
+STATIC int S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, const char *meth);
+STATIC int S_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 f, int n, SV *val);
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT)
@@ -986,8 +986,8 @@ PERL_CALLCONV void Perl_Slab_Free(pTHX_ void *op);
#if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
STATIC void S_find_beginning(pTHX);
-STATIC void S_forbid_setid(pTHX_ char *);
-STATIC void S_incpush(pTHX_ char *, int, int, int, int);
+STATIC void S_forbid_setid(pTHX_ const char * s);
+STATIC void S_incpush(pTHX_ const char *, int, int, int, int);
STATIC void S_init_interp(pTHX);
STATIC void S_init_ids(pTHX);
STATIC void S_init_lexer(pTHX);
@@ -998,14 +998,14 @@ STATIC void S_init_predump_symbols(pTHX);
STATIC void S_my_exit_jump(pTHX) __attribute__((noreturn));
STATIC void S_nuke_stacks(pTHX);
STATIC void S_open_script(pTHX_ char *, bool, SV *);
-STATIC void S_usage(pTHX_ char *);
-STATIC void S_validate_suid(pTHX_ char *, char*);
+STATIC void S_usage(pTHX_ const char *);
+STATIC void S_validate_suid(pTHX_ const char *validarg, const char *scriptname);
# if defined(IAMSUID)
STATIC int S_fd_on_nosuid_fs(pTHX_ int fd);
# endif
STATIC void* S_parse_body(pTHX_ char **env, XSINIT_t xsinit);
STATIC void* S_run_body(pTHX_ I32 oldscope);
-STATIC void S_call_body(pTHX_ OP *myop, int is_eval);
+STATIC void S_call_body(pTHX_ const OP *myop, int is_eval);
STATIC void* S_call_list_body(pTHX_ CV *cv);
#endif
@@ -1112,7 +1112,7 @@ STATIC void S_to_byte_substr(pTHX_ regexp * prog);
#if defined(PERL_IN_DUMP_C) || defined(PERL_DECL_PROT)
STATIC CV* S_deb_curcv(pTHX_ I32 ix);
-STATIC void S_debprof(pTHX_ OP *o);
+STATIC void S_debprof(pTHX_ const OP *o);
#endif
#if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT)
@@ -1297,9 +1297,9 @@ STATIC void S_deb_stack_n(pTHX_ SV** stack_base, I32 stack_min, I32 stack_max, I
PERL_CALLCONV PADLIST* Perl_pad_new(pTHX_ int flags);
PERL_CALLCONV void Perl_pad_undef(pTHX_ CV* cv);
-PERL_CALLCONV PADOFFSET Perl_pad_add_name(pTHX_ char *name, HV* typestash, HV* ourstash, bool clone);
+PERL_CALLCONV PADOFFSET Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool clone);
PERL_CALLCONV PADOFFSET Perl_pad_add_anon(pTHX_ SV* sv, OPCODE op_type);
-PERL_CALLCONV void Perl_pad_check_dup(pTHX_ char* name, bool is_our, HV* ourstash);
+PERL_CALLCONV void Perl_pad_check_dup(pTHX_ const char* name, bool is_our, const HV* ourstash);
#ifdef DEBUGGING
PERL_CALLCONV void Perl_pad_setsv(pTHX_ PADOFFSET po, SV* sv);
#endif
@@ -1311,15 +1311,15 @@ PERL_CALLCONV void Perl_pad_fixup_inner_anons(pTHX_ PADLIST *padlist, CV *old_cv
PERL_CALLCONV void Perl_pad_push(pTHX_ PADLIST *padlist, int depth);
#if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT)
-STATIC PADOFFSET S_pad_findlex(pTHX_ char *name, CV* cv, U32 seq, int warn, SV** out_capture, SV** out_name_sv, int *out_flags);
+STATIC PADOFFSET S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn, SV** out_capture, SV** out_name_sv, int *out_flags);
# if defined(DEBUGGING)
-STATIC void S_cv_dump(pTHX_ CV *cv, char *title);
+STATIC void S_cv_dump(pTHX_ const CV *cv, const char *title);
# endif
#endif
PERL_CALLCONV CV* Perl_find_runcv(pTHX_ U32 *db_seqp);
PERL_CALLCONV void Perl_free_tied_hv_pool(pTHX);
#if defined(DEBUGGING)
-PERL_CALLCONV int Perl_get_debug_opts(pTHX_ char **s, bool givehelp);
+PERL_CALLCONV int Perl_get_debug_opts(pTHX_ const char **s, bool givehelp);
#endif
PERL_CALLCONV void Perl_save_set_svflags(pTHX_ SV* sv, U32 mask, U32 val);
PERL_CALLCONV void Perl_hv_assert(pTHX_ HV* tb);
diff --git a/regcomp.c b/regcomp.c
index 1f7530f794..713669cade 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -478,8 +478,8 @@ static void clear_re(pTHX_ void *r);
STATIC void
S_scan_commit(pTHX_ RExC_state_t *pRExC_state, scan_data_t *data)
{
- STRLEN l = CHR_SVLEN(data->last_found);
- STRLEN old_l = CHR_SVLEN(*data->longest);
+ const STRLEN l = CHR_SVLEN(data->last_found);
+ const STRLEN old_l = CHR_SVLEN(*data->longest);
if ((l >= old_l) && ((l > old_l) || (data->flags & SF_BEFORE_EOL))) {
SvSetMagicSV(*data->longest, data->last_found);
@@ -793,13 +793,13 @@ and would end up looking like:
scan += len; \
len = 0; \
} else { \
- uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags); \
+ uvc = utf8n_to_uvuni( (const U8*)uc, UTF8_MAXLEN, &len, uniflags);\
uvc = to_uni_fold( uvc, foldbuf, &foldlen ); \
foldlen -= UNISKIP( uvc ); \
scan = foldbuf + UNISKIP( uvc ); \
} \
} else { \
- uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags); \
+ uvc = utf8n_to_uvuni( (const U8*)uc, UTF8_MAXLEN, &len, uniflags);\
} \
} else { \
uvc = (U32)*uc; \
@@ -837,13 +837,13 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
/* first pass, loop through and scan words */
reg_trie_data *trie;
regnode *cur;
- U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
+ const U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
STRLEN len = 0;
UV uvc = 0;
U16 curword = 0;
U32 next_alloc = 0;
/* we just use folder as a flag in utf8 */
- const U8 *folder=( flags == EXACTF
+ const U8 * const folder = ( flags == EXACTF
? PL_fold
: ( flags == EXACTFL
? PL_fold_locale
@@ -851,7 +851,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
)
);
- U32 data_slot = add_data( pRExC_state, 1, "t" );
+ const U32 data_slot = add_data( pRExC_state, 1, "t" );
SV *re_trie_maxbuff;
GET_RE_DEBUG_FLAGS_DECL;
@@ -897,11 +897,11 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
for ( cur = first ; cur < last ; cur = regnext( cur ) ) {
regnode *noper = NEXTOPER( cur );
- U8 *uc = (U8*)STRING( noper );
- U8 *e = uc + STR_LEN( noper );
+ const U8 *uc = (U8*)STRING( noper );
+ const U8 *e = uc + STR_LEN( noper );
STRLEN foldlen = 0;
U8 foldbuf[ UTF8_MAXBYTES_CASE + 1 ];
- U8 *scan;
+ const U8 *scan;
for ( ; uc < e ; uc += len ) {
trie->charcount++;
@@ -3591,8 +3591,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp)
}
{
- const char *p;
- static const char parens[] = "=!<,>";
+ const char *p;
+ static const char parens[] = "=!<,>";
if (paren && (p = strchr(parens, paren))) {
U8 node = ((p - parens) % 2) ? UNLESSM : IFMATCH;
@@ -5710,10 +5710,10 @@ S_dumpuntil(pTHX_ regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
node = dumpuntil(start, NEXTOPER(node), next, sv, l + 1);
}
else if ( PL_regkind[(U8)op] == TRIE ) {
- I32 n = ARG(node);
- reg_trie_data *trie=(reg_trie_data*)PL_regdata->data[n];
+ const I32 n = ARG(node);
+ const reg_trie_data *trie = (reg_trie_data*)PL_regdata->data[n];
+ const I32 arry_len = av_len(trie->words)+1;
I32 word_idx;
- I32 arry_len=av_len(trie->words)+1;
PerlIO_printf(Perl_debug_log,
"%*s[Words:%d Chars Stored:%d Unique Chars:%d States:%d%s]\n",
(int)(2*(l+3)), "",
@@ -5870,7 +5870,7 @@ Perl_regdump(pTHX_ regexp *r)
PerlIO_printf(Perl_debug_log, "\n");
if (r->offsets) {
U32 i;
- U32 len = r->offsets[0];
+ const U32 len = r->offsets[0];
GET_RE_DEBUG_FLAGS_DECL;
DEBUG_OFFSETS_r({
PerlIO_printf(Perl_debug_log, "Offsets: [%"UVuf"]\n\t", (UV)r->offsets[0]);
@@ -5928,7 +5928,7 @@ Perl_regprop(pTHX_ SV *sv, regnode *o)
pv_uni_display(dsv, (U8*)STRING(o), STR_LEN(o), 60,
UNI_DISPLAY_REGEX) :
STRING(o);
- int len = do_utf8 ?
+ const int len = do_utf8 ?
strlen(s) :
STR_LEN(o);
Perl_sv_catpvf(aTHX_ sv, " <%s%.*s%s>",
@@ -6131,13 +6131,10 @@ Perl_pregfree(pTHX_ struct regexp *r)
if (!r || (--r->refcnt > 0))
return;
DEBUG_r(if (re_debug_flags && (SvIV(re_debug_flags) & RE_DEBUG_COMPILE)) {
- int len;
- char *s;
-
- s = (r->reganch & ROPT_UTF8) ? pv_uni_display(dsv, (U8*)r->precomp,
- r->prelen, 60, UNI_DISPLAY_REGEX)
+ const char *s = (r->reganch & ROPT_UTF8)
+ ? pv_uni_display(dsv, (U8*)r->precomp, r->prelen, 60, UNI_DISPLAY_REGEX)
: pv_display(dsv, r->precomp, r->prelen, 0, 60);
- len = SvCUR(dsv);
+ const int len = SvCUR(dsv);
if (!PL_colorset)
reginitcolors();
PerlIO_printf(Perl_debug_log,
diff --git a/regcomp.h b/regcomp.h
index 74df7abf86..f1856b864b 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -311,7 +311,7 @@ struct regnode_charclass_class { /* has [[:blah:]] classes */
*/
#ifndef lint
#ifndef CHARMASK
-#define UCHARAT(p) ((int)*(U8*)(p))
+#define UCHARAT(p) ((int)*(const U8*)(p))
#else
#define UCHARAT(p) ((int)*(p)&CHARMASK)
#endif
@@ -528,7 +528,7 @@ typedef struct _reg_trie_data reg_trie_data;
#ifdef DEBUGGING
-#define GET_RE_DEBUG_FLAGS_DECL SV *re_debug_flags; GET_RE_DEBUG_FLAGS;
+#define GET_RE_DEBUG_FLAGS_DECL SV *re_debug_flags = NULL; GET_RE_DEBUG_FLAGS;
#else
#define GET_RE_DEBUG_FLAGS_DECL
#endif
diff --git a/regexec.c b/regexec.c
index dddc47c9af..fb846455d7 100644
--- a/regexec.c
+++ b/regexec.c
@@ -875,7 +875,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
s = find_byclass(prog, prog->regstclass, s, endpos, startpos, 1);
if (!s) {
#ifdef DEBUGGING
- char *what = 0;
+ const char *what = 0;
#endif
if (endpos == strend) {
DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
diff --git a/scope.c b/scope.c
index debdd4be6e..56ea96fb12 100644
--- a/scope.c
+++ b/scope.c
@@ -604,7 +604,7 @@ Perl_save_aelem(pTHX_ const AV *av, I32 idx, SV **sptr)
}
void
-Perl_save_helem(pTHX_ const HV *hv, SV *key, SV **sptr)
+Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr)
{
SV *sv;
SSCHECK(4);
diff --git a/sv.c b/sv.c
index b704fac55b..8d8b44663f 100644
--- a/sv.c
+++ b/sv.c
@@ -2119,7 +2119,7 @@ Perl_sv_grow(pTHX_ register SV *sv, register STRLEN newlen)
}
}
SvPV_set(sv, s);
- SvLEN_set(sv, newlen);
+ SvLEN_set(sv, newlen);
}
return s;
}
@@ -3492,6 +3492,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
if (SvTHINKFIRST(sv)) {
if (SvROK(sv)) {
SV* tmpstr;
+ register const char *typestr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,string)) &&
(!SvROK(tmpstr) || (SvRV(tmpstr) != SvRV(sv)))) {
char *pv = SvPV(tmpstr, *lp);
@@ -3504,7 +3505,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
origsv = sv;
sv = (SV*)SvRV(sv);
if (!sv)
- s = "NULLREF";
+ typestr = "NULLREF";
else {
MAGIC *mg;
@@ -3514,10 +3515,10 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
(SVs_OBJECT|SVf_OK|SVs_GMG|SVs_SMG|SVs_RMG))
== (SVs_OBJECT|SVs_SMG))
&& (mg = mg_find(sv, PERL_MAGIC_qr))) {
- regexp *re = (regexp *)mg->mg_obj;
+ const regexp *re = (regexp *)mg->mg_obj;
if (!mg->mg_ptr) {
- char *fptr = "msix";
+ const char *fptr = "msix";
char reflags[6];
char ch;
int left = 0;
@@ -3557,10 +3558,10 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
*/
if (PMf_EXTENDED & re->reganch)
{
- char *endptr = re->precomp + re->prelen;
+ const char *endptr = re->precomp + re->prelen;
while (endptr >= re->precomp)
{
- char c = *(endptr--);
+ const char c = *(endptr--);
if (c == '\n')
break; /* don't need another */
if (c == '#') {
@@ -3600,35 +3601,32 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
case SVt_PV:
case SVt_PVIV:
case SVt_PVNV:
- case SVt_PVBM: if (SvROK(sv))
- s = "REF";
- else
- s = "SCALAR"; break;
- case SVt_PVLV: s = SvROK(sv) ? "REF"
+ case SVt_PVBM: typestr = SvROK(sv) ? "REF" : "SCALAR"; break;
+ case SVt_PVLV: typestr = SvROK(sv) ? "REF"
/* tied lvalues should appear to be
* scalars for backwards compatitbility */
: (LvTYPE(sv) == 't' || LvTYPE(sv) == 'T')
? "SCALAR" : "LVALUE"; break;
- case SVt_PVAV: s = "ARRAY"; break;
- case SVt_PVHV: s = "HASH"; break;
- case SVt_PVCV: s = "CODE"; break;
- case SVt_PVGV: s = "GLOB"; break;
- case SVt_PVFM: s = "FORMAT"; break;
- case SVt_PVIO: s = "IO"; break;
- default: s = "UNKNOWN"; break;
+ case SVt_PVAV: typestr = "ARRAY"; break;
+ case SVt_PVHV: typestr = "HASH"; break;
+ case SVt_PVCV: typestr = "CODE"; break;
+ case SVt_PVGV: typestr = "GLOB"; break;
+ case SVt_PVFM: typestr = "FORMAT"; break;
+ case SVt_PVIO: typestr = "IO"; break;
+ default: typestr = "UNKNOWN"; break;
}
tsv = NEWSV(0,0);
if (SvOBJECT(sv)) {
const char *name = HvNAME(SvSTASH(sv));
Perl_sv_setpvf(aTHX_ tsv, "%s=%s(0x%"UVxf")",
- name ? name : "__ANON__" , s, PTR2UV(sv));
+ name ? name : "__ANON__" , typestr, PTR2UV(sv));
}
else
- Perl_sv_setpvf(aTHX_ tsv, "%s(0x%"UVxf")", s, PTR2UV(sv));
+ Perl_sv_setpvf(aTHX_ tsv, "%s(0x%"UVxf")", typestr, PTR2UV(sv));
goto tokensaveref;
}
- *lp = strlen(s);
- return s;
+ *lp = strlen(typestr);
+ return typestr;
}
if (SvREADONLY(sv) && !SvOK(sv)) {
if (ckWARN(WARN_UNINITIALIZED))
@@ -3640,8 +3638,8 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
if (SvIOK(sv) || ((SvIOKp(sv) && !SvNOKp(sv)))) {
/* I'm assuming that if both IV and NV are equally valid then
converting the IV is going to be more efficient */
- U32 isIOK = SvIOK(sv);
- U32 isUIOK = SvIsUV(sv);
+ const U32 isIOK = SvIOK(sv);
+ const U32 isUIOK = SvIsUV(sv);
char buf[TYPE_CHARS(UV)];
char *ebuf, *ptr;
@@ -5327,7 +5325,7 @@ to contain an C<SV*> and is stored as-is with its REFCNT incremented.
=cut
*/
MAGIC *
-Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, MGVTBL *vtable,
+Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, const MGVTBL *vtable,
const char* name, I32 namlen)
{
MAGIC* mg;
@@ -5413,8 +5411,8 @@ to add more than one instance of the same 'how'.
void
Perl_sv_magic(pTHX_ register SV *sv, SV *obj, int how, const char *name, I32 namlen)
{
+ const MGVTBL *vtable = 0;
MAGIC* mg;
- MGVTBL *vtable = 0;
#ifdef PERL_COPY_ON_WRITE
if (SvIsCOW(sv))
@@ -5588,7 +5586,7 @@ Perl_sv_unmagic(pTHX_ SV *sv, int type)
mgp = &SvMAGIC(sv);
for (mg = *mgp; mg; mg = *mgp) {
if (mg->mg_type == type) {
- MGVTBL* vtbl = mg->mg_virtual;
+ const MGVTBL* const vtbl = mg->mg_virtual;
*mgp = mg->mg_moremagic;
if (vtbl && vtbl->svt_free)
CALL_FPTR(vtbl->svt_free)(aTHX_ sv, mg);
@@ -5707,7 +5705,7 @@ the Perl substr() function.
*/
void
-Perl_sv_insert(pTHX_ SV *bigstr, STRLEN offset, STRLEN len, char *little, STRLEN littlelen)
+Perl_sv_insert(pTHX_ SV *bigstr, STRLEN offset, STRLEN len, const char *little, STRLEN littlelen)
{
register char *big;
register char *mid;
@@ -6615,9 +6613,9 @@ coerce its args to strings if necessary.
I32
Perl_sv_eq(pTHX_ register SV *sv1, register SV *sv2)
{
- char *pv1;
+ const char *pv1;
STRLEN cur1;
- char *pv2;
+ const char *pv2;
STRLEN cur2;
I32 eq = 0;
char *tpv = Nullch;
@@ -6663,7 +6661,7 @@ Perl_sv_eq(pTHX_ register SV *sv1, register SV *sv2)
if (SvUTF8(sv1)) {
/* sv1 is the UTF-8 one,
* if is equal it must be downgrade-able */
- char *pv = (char*)bytes_from_utf8((U8*)pv1,
+ char *pv = (char*)bytes_from_utf8((const U8*)pv1,
&cur1, &is_utf8);
if (pv != pv1)
pv1 = tpv = pv;
@@ -6671,7 +6669,7 @@ Perl_sv_eq(pTHX_ register SV *sv1, register SV *sv2)
else {
/* sv2 is the UTF-8 one,
* if is equal it must be downgrade-able */
- char *pv = (char *)bytes_from_utf8((U8*)pv2,
+ char *pv = (char *)bytes_from_utf8((const U8*)pv2,
&cur2, &is_utf8);
if (pv != pv2)
pv2 = tpv = pv;
@@ -6711,7 +6709,8 @@ I32
Perl_sv_cmp(pTHX_ register SV *sv1, register SV *sv2)
{
STRLEN cur1, cur2;
- char *pv1, *pv2, *tpv = Nullch;
+ const char *pv1, *pv2;
+ char *tpv = Nullch;
I32 cmp;
SV *svrecode = Nullsv;
@@ -6739,7 +6738,7 @@ Perl_sv_cmp(pTHX_ register SV *sv1, register SV *sv2)
pv2 = SvPV(svrecode, cur2);
}
else {
- pv2 = tpv = (char*)bytes_to_utf8((U8*)pv2, &cur2);
+ pv2 = tpv = (char*)bytes_to_utf8((const U8*)pv2, &cur2);
}
}
else {
@@ -6749,7 +6748,7 @@ Perl_sv_cmp(pTHX_ register SV *sv1, register SV *sv2)
pv1 = SvPV(svrecode, cur1);
}
else {
- pv1 = tpv = (char*)bytes_to_utf8((U8*)pv1, &cur1);
+ pv1 = tpv = (char*)bytes_to_utf8((const U8*)pv1, &cur1);
}
}
}
@@ -6759,7 +6758,7 @@ Perl_sv_cmp(pTHX_ register SV *sv1, register SV *sv2)
} else if (!cur2) {
cmp = 1;
} else {
- I32 retval = memcmp((void*)pv1, (void*)pv2, cur1 < cur2 ? cur1 : cur2);
+ const I32 retval = memcmp((const void*)pv1, (const void*)pv2, cur1 < cur2 ? cur1 : cur2);
if (retval) {
cmp = retval < 0 ? -1 : 1;
@@ -6911,7 +6910,7 @@ appending to the currently-stored string.
char *
Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append)
{
- char *rsptr;
+ const char *rsptr;
STRLEN rslen;
register STDCHAR rslast;
register STDCHAR *bp;
@@ -7674,7 +7673,7 @@ Perl_newSVpvn_share(pTHX_ const char *src, I32 len, U32 hash)
STRLEN tmplen = -len;
is_utf8 = TRUE;
/* See the note in hv.c:hv_fetch() --jhi */
- src = (char*)bytes_from_utf8((U8*)src, &tmplen, &is_utf8);
+ src = (char*)bytes_from_utf8((const U8*)src, &tmplen, &is_utf8);
len = tmplen;
}
if (!hash)
@@ -7873,7 +7872,7 @@ Note that the perl-level function is vaguely deprecated.
*/
void
-Perl_sv_reset(pTHX_ register char *s, HV *stash)
+Perl_sv_reset(pTHX_ register const char *s, HV *stash)
{
register HE *entry;
register GV *gv;
@@ -8092,7 +8091,7 @@ Perl_sv_true(pTHX_ register SV *sv)
if (!sv)
return 0;
if (SvPOK(sv)) {
- register XPV* tXpv;
+ const register XPV* tXpv;
if ((tXpv = (XPV*)SvANY(sv)) &&
(tXpv->xpv_cur > 1 ||
(tXpv->xpv_cur && *tXpv->xpv_pv != '0')))
@@ -9293,7 +9292,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
STRLEN have;
STRLEN need;
STRLEN gap;
- char *dotstr = ".";
+ const char *dotstr = ".";
STRLEN dotstrlen = 1;
I32 efix = 0; /* explicit format parameter index */
I32 ewix = 0; /* explicit width index */
@@ -10226,7 +10225,7 @@ Perl_re_dup(pTHX_ REGEXP *r, CLONE_PARAMS *param)
ret->regstclass = NULL;
if (r->data) {
struct reg_data *d;
- int count = r->data->count;
+ const int count = r->data->count;
Newc(0, d, sizeof(struct reg_data) + count*sizeof(void *),
char, struct reg_data);
diff --git a/taint.c b/taint.c
index ec568be2cc..c2865facb9 100644
--- a/taint.c
+++ b/taint.c
@@ -24,7 +24,7 @@
void
Perl_taint_proper(pTHX_ const char *f, const char *s)
{
- char *ug;
+ const char *ug;
#if defined(HAS_SETEUID) && defined(DEBUGGING)
# if Uid_t_size == 1
@@ -74,8 +74,8 @@ Perl_taint_env(pTHX)
{
SV** svp;
MAGIC* mg;
- char** e;
- static char* misc_env[] = {
+ const char** e;
+ static const char* misc_env[] = {
"IFS", /* most shells' inter-field separators */
"CDPATH", /* ksh dain bramage #1 */
"ENV", /* ksh dain bramage #2 */
@@ -90,7 +90,7 @@ Perl_taint_env(pTHX)
* it probably doesn't reflect the actual environment */
if (!GvHV(PL_envgv) || !(SvRMAGICAL(GvHV(PL_envgv))
&& mg_find((SV*)GvHV(PL_envgv), PERL_MAGIC_env))) {
- bool was_tainted = PL_tainted;
+ const bool was_tainted = PL_tainted;
char *name = GvENAME(PL_envgv);
PL_tainted = TRUE;
if (strEQ(name,"ENV"))
diff --git a/universal.c b/universal.c
index 760c33bffb..adff0fff03 100644
--- a/universal.c
+++ b/universal.c
@@ -137,7 +137,7 @@ for class names as well as for objects.
bool
Perl_sv_derived_from(pTHX_ SV *sv, const char *name)
{
- char *type;
+ const char *type;
HV *stash;
HV *name_stash;
@@ -199,7 +199,7 @@ XS(XS_Internals_HvREHASH);
void
Perl_boot_core_UNIVERSAL(pTHX)
{
- char *file = __FILE__;
+ const char file[] = __FILE__;
newXS("UNIVERSAL::isa", XS_UNIVERSAL_isa, file);
newXS("UNIVERSAL::can", XS_UNIVERSAL_can, file);
@@ -320,7 +320,7 @@ XS(XS_UNIVERSAL_VERSION)
GV **gvp;
GV *gv;
SV *sv;
- char *undef;
+ const char *undef;
if (SvROK(ST(0))) {
sv = (SV*)SvRV(ST(0));
@@ -357,7 +357,7 @@ XS(XS_UNIVERSAL_VERSION)
"%s does not define $%s::VERSION--version check failed",
HvNAME(pkg), HvNAME(pkg));
else {
- char *str = SvPVx(ST(0), len);
+ const char *str = SvPVx(ST(0), len);
Perl_croak(aTHX_
"%s defines neither package nor VERSION--version check failed", str);
@@ -394,7 +394,7 @@ XS(XS_version_new)
Perl_croak(aTHX_ "Usage: version::new(class, version)");
SP -= items;
{
- char * class = (char *)SvPV_nolen(ST(0));
+ const char *class = SvPV_nolen(ST(0));
SV *vs = ST(1);
SV *rv;
if (items == 3 )
diff --git a/utf8.c b/utf8.c
index 905ff85c2d..bb31862be9 100644
--- a/utf8.c
+++ b/utf8.c
@@ -240,7 +240,7 @@ Perl_is_utf8_string(pTHX_ const U8 *s, STRLEN len)
STRLEN c;
if (!len && s)
- len = strlen((char *)s);
+ len = strlen((const char *)s);
send = s + len;
while (x < send) {
@@ -280,7 +280,7 @@ Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **p)
STRLEN c;
if (!len && s)
- len = strlen((char *)s);
+ len = strlen((const char *)s);
send = s + len;
while (x < send) {
@@ -766,7 +766,7 @@ Perl_utf8_to_bytes(pTHX_ U8 *s, STRLEN *len)
}
/*
-=for apidoc A|U8 *|bytes_from_utf8|U8 *s|STRLEN *len|bool *is_utf8
+=for apidoc A|U8 *|bytes_from_utf8|const U8 *s|STRLEN *len|bool *is_utf8
Converts a string C<s> of length C<len> from UTF-8 into byte encoding.
Unlike C<utf8_to_bytes> but like C<bytes_to_utf8>, returns a pointer to
@@ -779,11 +779,11 @@ is unchanged. Do nothing if C<is_utf8> points to 0. Sets C<is_utf8> to
*/
U8 *
-Perl_bytes_from_utf8(pTHX_ U8 *s, STRLEN *len, bool *is_utf8)
+Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8)
{
U8 *d;
- U8 *start = s;
- U8 *send;
+ const U8 *start = s;
+ const U8 *send;
I32 count = 0;
if (!*is_utf8)
@@ -791,7 +791,7 @@ Perl_bytes_from_utf8(pTHX_ U8 *s, STRLEN *len, bool *is_utf8)
/* ensure valid UTF-8 and chars < 256 before converting string */
for (send = s + *len; s < send;) {
- U8 c = *s++;
+ U8 c = *s++;
if (!UTF8_IS_INVARIANT(c)) {
if (UTF8_IS_DOWNGRADEABLE_START(c) && s < send &&
(c = *s++) && UTF8_IS_CONTINUATION(c))
@@ -1397,7 +1397,7 @@ The "normal" is a string like "ToLower" which means the swash
=cut */
UV
-Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, char *normal, char *special)
+Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, const char *normal, const char *special)
{
UV uv1;
U8 tmpbuf[UTF8_MAXBYTES_CASE+1];
@@ -1693,14 +1693,14 @@ Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8)
if (hv == PL_last_swash_hv &&
klen == PL_last_swash_klen &&
- (!klen || memEQ((char *)ptr, (char *)PL_last_swash_key, klen)) )
+ (!klen || memEQ(ptr, PL_last_swash_key, klen)) )
{
tmps = PL_last_swash_tmps;
slen = PL_last_swash_slen;
}
else {
/* Try our second-level swatch cache, kept in a hash. */
- SV** svp = hv_fetch(hv, (char*)ptr, klen, FALSE);
+ SV** svp = hv_fetch(hv, (const char*)ptr, klen, FALSE);
/* If not cached, generate it via utf8::SWASHGET */
if (!svp || !SvPOK(*svp) || !(tmps = (U8*)SvPV(*svp, slen))) {
@@ -1738,7 +1738,7 @@ Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8)
if (IN_PERL_COMPILETIME)
PL_curcop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
- svp = hv_store(hv, (char*)ptr, klen, retval, 0);
+ svp = hv_store(hv, (const char *)ptr, klen, retval, 0);
if (!svp || !(tmps = (U8*)SvPV(*svp, slen)) || (slen << 3) < needents)
Perl_croak(aTHX_ "SWASHGET didn't return result of proper length");
@@ -1844,13 +1844,13 @@ The pointer to the PV of the dsv is returned.
=cut */
char *
-Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
+Perl_pv_uni_display(pTHX_ SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
{
int truncated = 0;
- char *s, *e;
+ const char *s, *e;
sv_setpvn(dsv, "", 0);
- for (s = (char *)spv, e = s + len; s < e; s += UTF8SKIP(s)) {
+ for (s = (const char *)spv, e = s + len; s < e; s += UTF8SKIP(s)) {
UV u;
/* This serves double duty as a flag and a character to print after
a \ when flags & UNI_DISPLAY_BACKSLASH is true.
@@ -1946,10 +1946,11 @@ http://www.unicode.org/unicode/reports/tr21/ (Case Mappings).
I32
Perl_ibcmp_utf8(pTHX_ const char *s1, char **pe1, register UV l1, bool u1, const char *s2, char **pe2, register UV l2, bool u2)
{
- register U8 *p1 = (U8*)s1;
- register U8 *p2 = (U8*)s2;
- register U8 *e1 = 0, *f1 = 0, *q1 = 0;
- register U8 *e2 = 0, *f2 = 0, *q2 = 0;
+ register const U8 *p1 = (const U8*)s1;
+ register const U8 *p2 = (const U8*)s2;
+ register const U8 *f1 = 0, *f2 = 0;
+ register U8 *e1 = 0, *q1 = 0;
+ register U8 *e2 = 0, *q2 = 0;
STRLEN n1 = 0, n2 = 0;
U8 foldbuf1[UTF8_MAXBYTES_CASE+1];
U8 foldbuf2[UTF8_MAXBYTES_CASE+1];
@@ -1959,12 +1960,12 @@ Perl_ibcmp_utf8(pTHX_ const char *s1, char **pe1, register UV l1, bool u1, const
if (pe1)
e1 = *(U8**)pe1;
- if (e1 == 0 || (l1 && l1 < (UV)(e1 - (U8*)s1)))
- f1 = (U8*)s1 + l1;
+ if (e1 == 0 || (l1 && l1 < (UV)(e1 - (const U8*)s1)))
+ f1 = (const U8*)s1 + l1;
if (pe2)
e2 = *(U8**)pe2;
- if (e2 == 0 || (l2 && l2 < (UV)(e2 - (U8*)s2)))
- f2 = (U8*)s2 + l2;
+ if (e2 == 0 || (l2 && l2 < (UV)(e2 - (const U8*)s2)))
+ f2 = (const U8*)s2 + l2;
if ((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0))
return 1; /* mismatch; possible infinite loop or false positive */
diff --git a/utf8.h b/utf8.h
index c206b3da39..a8d440d3bf 100644
--- a/utf8.h
+++ b/utf8.h
@@ -42,7 +42,7 @@ EXTCONST unsigned char PL_utf8skip[];
#endif
END_EXTERN_C
-#define UTF8SKIP(s) PL_utf8skip[*(U8*)s]
+#define UTF8SKIP(s) PL_utf8skip[*(const U8*)s]
/* Native character to iso-8859-1 */
#define NATIVE_TO_ASCII(ch) (ch)
@@ -147,12 +147,12 @@ encoded character.
* (that is, the two high bits are set). Otherwise we risk loading in the
* heavy-duty SWASHINIT and SWASHGET routines unnecessarily.
*/
-#define isIDFIRST_lazy_if(p,c) ((IN_BYTES || (!c || (*((U8*)p) < 0xc0))) \
+#define isIDFIRST_lazy_if(p,c) ((IN_BYTES || (!c || (*((const U8*)p) < 0xc0))) \
? isIDFIRST(*(p)) \
- : isIDFIRST_utf8((U8*)p))
-#define isALNUM_lazy_if(p,c) ((IN_BYTES || (!c || (*((U8*)p) < 0xc0))) \
+ : isIDFIRST_utf8((const U8*)p))
+#define isALNUM_lazy_if(p,c) ((IN_BYTES || (!c || (*((const U8*)p) < 0xc0))) \
? isALNUM(*(p)) \
- : isALNUM_utf8((U8*)p))
+ : isALNUM_utf8((const U8*)p))
#endif /* EBCDIC vs ASCII */
diff --git a/utfebcdic.h b/utfebcdic.h
index e47e90d7de..7d03608b41 100644
--- a/utfebcdic.h
+++ b/utfebcdic.h
@@ -337,7 +337,7 @@ EXTCONST unsigned char PL_a2e[];
END_EXTERN_C
-#define UTF8SKIP(s) PL_utf8skip[*(U8*)s]
+#define UTF8SKIP(s) PL_utf8skip[*(const U8*)s]
/* EBCDIC-happy ways of converting native code to UTF-8 */
@@ -363,10 +363,10 @@ END_EXTERN_C
#define isIDFIRST_lazy_if(p,c) ((IN_BYTES || (!c || UTF8_IS_INVARIANT(*p))) \
? isIDFIRST(*(p)) \
- : isIDFIRST_utf8((U8*)p))
+ : isIDFIRST_utf8((const U8*)p))
#define isALNUM_lazy_if(p,c) ((IN_BYTES || (!c || UTF8_IS_INVARIANT(*p))) \
? isALNUM(*(p)) \
- : isALNUM_utf8((U8*)p))
+ : isALNUM_utf8((const U8*)p))
/*
The following table is adapted from tr16, it shows UTF-8-mod encoding of Unicode code points.
diff --git a/util.c b/util.c
index fc99463e44..ca781771a3 100644
--- a/util.c
+++ b/util.c
@@ -224,7 +224,7 @@ Free_t Perl_mfree (Malloc_t where)
/* copy a string up to some (non-backslashed) delimiter, if any */
char *
-Perl_delimcpy(pTHX_ register char *to, register char *toend, register char *from, register char *fromend, register int delim, I32 *retlen)
+Perl_delimcpy(pTHX_ register char *to, register const char *toend, register const char *from, register const char *fromend, register int delim, I32 *retlen)
{
register I32 tolen;
for (tolen = 0; from < fromend; from++, tolen++) {
@@ -286,7 +286,7 @@ char *
Perl_ninstr(pTHX_ register const char *big, register const char *bigend, const char *little, const char *lend)
{
register const char *s, *x;
- register I32 first = *little;
+ register const I32 first = *little;
register const char *littleend = lend;
if (!first && little >= littleend)
@@ -316,7 +316,7 @@ Perl_rninstr(pTHX_ register const char *big, const char *bigend, const char *lit
{
register const char *bigbeg;
register const char *s, *x;
- register I32 first = *little;
+ register const I32 first = *little;
register const char *littleend = lend;
if (!first && little >= littleend)
@@ -439,14 +439,14 @@ Perl_fbm_instr(pTHX_ unsigned char *big, register unsigned char *bigend, SV *lit
STRLEN l;
register unsigned char *little = (unsigned char *)SvPV(littlestr,l);
register STRLEN littlelen = l;
- register I32 multiline = flags & FBMrf_MULTILINE;
+ register const I32 multiline = flags & FBMrf_MULTILINE;
if ((STRLEN)(bigend - big) < littlelen) {
if ( SvTAIL(littlestr)
&& ((STRLEN)(bigend - big) == littlelen - 1)
&& (littlelen == 1
|| (*big == *little &&
- memEQ((char *)big, (char *)little, littlelen - 1))))
+ memEQ(big, little, littlelen - 1))))
return (char*)big;
return Nullch;
}
@@ -567,7 +567,7 @@ Perl_fbm_instr(pTHX_ unsigned char *big, register unsigned char *bigend, SV *lit
}
{ /* Do actual FBM. */
- register unsigned char *table = little + littlelen + FBM_TABLE_OFFSET;
+ register const unsigned char *table = little + littlelen + FBM_TABLE_OFFSET;
register unsigned char *oldlittle;
if (littlelen > (STRLEN)(bigend - big))
@@ -716,8 +716,8 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
I32
Perl_ibcmp(pTHX_ const char *s1, const char *s2, register I32 len)
{
- register U8 *a = (U8 *)s1;
- register U8 *b = (U8 *)s2;
+ register const U8 *a = (const U8 *)s1;
+ register const U8 *b = (const U8 *)s2;
while (len--) {
if (*a != *b && *a != PL_fold[*b])
return 1;
@@ -729,8 +729,8 @@ Perl_ibcmp(pTHX_ const char *s1, const char *s2, register I32 len)
I32
Perl_ibcmp_locale(pTHX_ const char *s1, const char *s2, register I32 len)
{
- register U8 *a = (U8 *)s1;
- register U8 *b = (U8 *)s2;
+ register const U8 *a = (const U8 *)s1;
+ register const U8 *b = (const U8 *)s2;
while (len--) {
if (*a != *b && *a != PL_fold_locale[*b])
return 1;
@@ -987,7 +987,6 @@ Perl_vmess(pTHX_ const char *pat, va_list *args)
{
SV *sv = mess_alloc();
static char dgd[] = " during global destruction.\n";
- COP *cop;
sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));
if (!SvCUR(sv) || *(SvEND(sv) - 1) != '\n') {
@@ -999,14 +998,14 @@ Perl_vmess(pTHX_ const char *pat, va_list *args)
* from the sibling of PL_curcop.
*/
- cop = closest_cop(PL_curcop, PL_curcop->op_sibling);
+ const COP *cop = closest_cop(PL_curcop, PL_curcop->op_sibling);
if (!cop) cop = PL_curcop;
if (CopLINE(cop))
Perl_sv_catpvf(aTHX_ sv, " at %s line %"IVdf,
OutCopFILE(cop), (IV)CopLINE(cop));
if (GvIO(PL_last_in_gv) && IoLINES(GvIOp(PL_last_in_gv))) {
- bool line_mode = (RsSIMPLE(PL_rs) &&
+ const bool line_mode = (RsSIMPLE(PL_rs) &&
SvCUR(PL_rs) == 1 && *SvPVX(PL_rs) == '\n');
Perl_sv_catpvf(aTHX_ sv, ", <%s> %s %"IVdf,
PL_last_in_gv == PL_argvgv ?
@@ -1144,7 +1143,7 @@ OP *
Perl_vdie(pTHX_ const char* pat, va_list *args)
{
char *message;
- int was_in_eval = PL_in_eval;
+ const int was_in_eval = PL_in_eval;
STRLEN msglen;
I32 utf8 = 0;
@@ -1358,7 +1357,7 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args)
if (ckDEAD(err)) {
SV *msv = vmess(pat, args);
STRLEN msglen;
- char *message = SvPV(msv, msglen);
+ const char *message = SvPV(msv, msglen);
I32 utf8 = SvUTF8(msv);
if (PL_diehook) {
@@ -1392,7 +1391,7 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args)
/* VMS' my_setenv() is in vms.c */
#if !defined(WIN32) && !defined(NETWARE)
void
-Perl_my_setenv(pTHX_ char *nam, char *val)
+Perl_my_setenv(pTHX_ const char *nam, const char *val)
{
#ifdef USE_ITHREADS
/* only parent thread can modify process environment */
@@ -1414,7 +1413,7 @@ Perl_my_setenv(pTHX_ char *nam, char *val)
for (max = i; environ[max]; max++) ;
tmpenv = (char**)safesysmalloc((max+2) * sizeof(char*));
for (j=0; j<max; j++) { /* copy environment */
- int len = strlen(environ[j]);
+ const int len = strlen(environ[j]);
tmpenv[j] = (char*)safesysmalloc((len+1)*sizeof(char));
Copy(environ[j], tmpenv[j], len+1, char);
}
@@ -1466,10 +1465,11 @@ Perl_my_setenv(pTHX_ char *nam, char *val)
#else /* WIN32 || NETWARE */
void
-Perl_my_setenv(pTHX_ char *nam,char *val)
+Perl_my_setenv(pTHX_ const char *nam, char *val)
{
register char *envstr;
- int nlen = strlen(nam), vlen;
+ const int nlen = strlen(nam);
+ int vlen;
if (!val) {
val = "";
@@ -1485,7 +1485,7 @@ Perl_my_setenv(pTHX_ char *nam,char *val)
#ifndef PERL_MICRO
I32
-Perl_setenv_getix(pTHX_ char *nam)
+Perl_setenv_getix(pTHX_ const char *nam)
{
register I32 i, len = strlen(nam);
@@ -1568,8 +1568,8 @@ Perl_my_bzero(register char *loc, register I32 len)
I32
Perl_my_memcmp(const char *s1, const char *s2, register I32 len)
{
- register U8 *a = (U8 *)s1;
- register U8 *b = (U8 *)s2;
+ register const U8 *a = (const U8 *)s1;
+ register const U8 *b = (const U8 *)s2;
register I32 tmp;
while (len--) {
@@ -2731,9 +2731,9 @@ Perl_same_dirent(pTHX_ char *a, char *b)
#endif /* !HAS_RENAME */
char*
-Perl_find_script(pTHX_ char *scriptname, bool dosearch, char **search_ext, I32 flags)
+Perl_find_script(pTHX_ const char *scriptname, bool dosearch, const char **search_ext, I32 flags)
{
- char *xfound = Nullch;
+ const char *xfound = Nullch;
char *xfailed = Nullch;
char tmpbuf[MAXPATHLEN];
register char *s;
@@ -2753,10 +2753,10 @@ Perl_find_script(pTHX_ char *scriptname, bool dosearch, char **search_ext, I32 f
#endif
/* additional extensions to try in each dir if scriptname not found */
#ifdef SEARCH_EXTS
- char *exts[] = { SEARCH_EXTS };
- char **ext = search_ext ? search_ext : exts;
+ const char *exts[] = { SEARCH_EXTS };
+ const char **ext = search_ext ? search_ext : exts;
int extidx = 0, i = 0;
- char *curext = Nullch;
+ const char *curext = Nullch;
#else
# define MAX_EXT_LEN 0
#endif
@@ -3007,22 +3007,22 @@ Perl_GetVars(pTHX)
}
#endif
-char **
+const char **
Perl_get_op_names(pTHX)
{
return PL_op_name;
}
-char **
+const char **
Perl_get_op_descs(pTHX)
{
return PL_op_desc;
}
-char *
+const char *
Perl_get_no_modify(pTHX)
{
- return (char*)PL_no_modify;
+ return PL_no_modify;
}
U32 *
@@ -3202,17 +3202,17 @@ Perl_my_fflush_all(pTHX)
}
void
-Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op)
+Perl_report_evil_fh(pTHX_ const GV *gv, const IO *io, I32 op)
{
- char *func =
+ const char *func =
op == OP_READLINE ? "readline" : /* "<HANDLE>" not nice */
op == OP_LEAVEWRITE ? "write" : /* "write exit" not nice */
PL_op_desc[op];
- char *pars = OP_IS_FILETEST(op) ? "" : "()";
- char *type = OP_IS_SOCKET(op)
+ const char *pars = OP_IS_FILETEST(op) ? "" : "()";
+ const char *type = OP_IS_SOCKET(op)
|| (gv && io && IoTYPE(io) == IoTYPE_SOCKET)
? "socket" : "filehandle";
- char *name = NULL;
+ const char *name = NULL;
if (gv && isGV(gv)) {
name = GvENAME(gv);
@@ -3231,7 +3231,7 @@ Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op)
}
}
else {
- char *vile;
+ const char *vile;
I32 warn_type;
if (gv && io && IoTYPE(io) == IoTYPE_CLOSED) {
@@ -3276,7 +3276,7 @@ int
Perl_ebcdic_control(pTHX_ int ch)
{
if (ch > 'a') {
- char *ctlp;
+ const char *ctlp;
if (islower(ch))
ch = toupper(ch);
@@ -3538,7 +3538,7 @@ Perl_mini_mktime(pTHX_ struct tm *ptm)
}
char *
-Perl_my_strftime(pTHX_ char *fmt, int sec, int min, int hour, int mday, int mon, int year, int wday, int yday, int isdst)
+Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, int mon, int year, int wday, int yday, int isdst)
{
#ifdef HAS_STRFTIME
char *buf;
@@ -3592,8 +3592,8 @@ Perl_my_strftime(pTHX_ char *fmt, int sec, int min, int hour, int mday, int mon,
return buf;
else {
/* Possibly buf overflowed - try again with a bigger buf */
- int fmtlen = strlen(fmt);
- int bufsize = fmtlen + buflen;
+ const int fmtlen = strlen(fmt);
+ const int bufsize = fmtlen + buflen;
New(0, buf, bufsize, char);
while (buf) {
@@ -3606,8 +3606,7 @@ Perl_my_strftime(pTHX_ char *fmt, int sec, int min, int hour, int mday, int mon,
buf = NULL;
break;
}
- bufsize *= 2;
- Renew(buf, bufsize, char);
+ Renew(buf, bufsize*2, char);
}
return buf;
}
@@ -3813,10 +3812,10 @@ it doesn't.
*/
char *
-Perl_scan_version(pTHX_ char *s, SV *rv, bool qv)
+Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv)
{
const char *start = s;
- char *pos = s;
+ const char *pos = s;
I32 saw_period = 0;
bool saw_under = 0;
SV* sv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
@@ -3857,7 +3856,7 @@ Perl_scan_version(pTHX_ char *s, SV *rv, bool qv)
rev = 0;
{
/* this is atoi() that delimits on underscores */
- char *end = pos;
+ const char *end = pos;
I32 mult = 1;
I32 orev;
if ( s < pos && s > start && *(s-1) == '_' ) {
@@ -4500,9 +4499,9 @@ Perl_sv_nounlocking(pTHX_ SV *sv)
}
U32
-Perl_parse_unicode_opts(pTHX_ char **popt)
+Perl_parse_unicode_opts(pTHX_ const char **popt)
{
- char *p = *popt;
+ const char *p = *popt;
U32 opt = 0;
if (*p) {
@@ -4637,7 +4636,7 @@ Perl_seed(pTHX)
UV
Perl_get_hash_seed(pTHX)
{
- char *s = PerlEnv_getenv("PERL_HASH_SEED");
+ const char *s = PerlEnv_getenv("PERL_HASH_SEED");
UV myseed = 0;
if (s)
diff --git a/writemain.SH b/writemain.SH
index ed8aca69ed..0b5bd07600 100644
--- a/writemain.SH
+++ b/writemain.SH
@@ -77,7 +77,7 @@ xs_init(pTHX)
EOP
if test X"$args" != "X" ; then
- echo " char *file = __FILE__;"
+ echo " const char file[] = __FILE__;"
echo " dXSUB_SYS;"
ai=''
diff --git a/xsutils.c b/xsutils.c
index c09a376b98..a20b0d2658 100644
--- a/xsutils.c
+++ b/xsutils.c
@@ -46,7 +46,7 @@ void XS_attributes_bootstrap(pTHX_ CV *cv);
void
Perl_boot_core_xsutils(pTHX)
{
- char *file = __FILE__;
+ const char file[] = __FILE__;
newXS("attributes::bootstrap", XS_attributes_bootstrap, file);
}
@@ -159,7 +159,7 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs)
XS(XS_attributes_bootstrap)
{
dXSARGS;
- char *file = __FILE__;
+ const char file[] = __FILE__;
if( items > 1 )
Perl_croak(aTHX_ "Usage: attributes::bootstrap $module");