# 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 { \
#ifdef DEBUGGING
I32 ix, si_ix;
PERL_SI *si;
- PERL_CONTEXT *cx;
/* rewind to start of chain */
si = PL_curstackinfo;
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)]
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
|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) {
fd = atoi(type);
}
else {
- IO* thatio;
+ const IO* thatio;
if (num_svs) {
thatio = sv_2io(*svp);
}
/* 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";
bool
Perl_do_print(pTHX_ register SV *sv, PerlIO *fp)
{
- register char *tmps;
+ register const char *tmps;
STRLEN len;
/* assuming fp is checked earlier */
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) {
register I32 val;
register I32 val2;
register I32 tot = 0;
- char *what;
+ const char *what;
char *s;
SV **oldmark = mark;
STRLEN n_a;
}
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))
}
void
-Perl_dump_sub(pTHX_ GV *gv)
+Perl_dump_sub(pTHX_ const GV *gv)
{
SV *sv = sv_newmortal();
}
void
-Perl_dump_form(pTHX_ GV *gv)
+Perl_dump_form(pTHX_ const GV *gv)
{
SV *sv = sv_newmortal();
}
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) {
{
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;
}
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))
}
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))
}
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)) {
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;
while ((he = hv_iternext_flags(hv, HV_ITERNEXT_WANTPLACEHOLDERS))
&& count--) {
SV *elt, *keysv;
- char *keypv;
+ const char *keypv;
STRLEN len;
U32 hash = HeHASH(he);
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"
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))
}
STATIC void
-S_debprof(pTHX_ OP *o)
+S_debprof(pTHX_ const OP *o)
{
if (CopSTASH_eq(PL_curcop, PL_debstash) && !DEBUG_J_TEST_)
return;
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)
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
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|...
#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|...
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
#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
#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
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
#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)
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
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
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);
HV* varstash;
GV* vargv;
SV* varsv;
- char *packname = "";
+ const char *packname = "";
if (len == autolen && strnEQ(name, autoload, autolen))
return Nullgv;
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));
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 *
void
Perl_gv_check(pTHX_ HV *stash)
{
- register HE *entry;
register I32 i;
register GV *gv;
HV *hv;
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)))
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;
}
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);
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)) );
"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);
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);
}
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))
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,
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) {
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 */
/* 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;
}
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;
int
Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
{
- register char *s;
+ register const char *s;
I32 i;
STRLEN len;
switch (*mg->mg_ptr) {
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 '=':
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))
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. */
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;
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){
}
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.
continue;
}
if (*s == '_' && len && allow_underscores && s[1]
- && (hexdigit = strchr((char *) PL_hexdigit, s[1])))
+ && (hexdigit = strchr(PL_hexdigit, s[1])))
{
--len;
++s;
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};
++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;
Perl_scalarvoid(pTHX_ OP *o)
{
OP *kid;
- char* useless = 0;
+ const char* useless = 0;
SV* sv;
U8 want;
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 ||
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;
}
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);
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
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 ");
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);
*/
CV *
-Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv)
+Perl_newCONSTSUB(pTHX_ HV *stash, const char *name, SV *sv)
{
CV* cv;
CvXSUB(cv) = subaddr;
if (name) {
- char *s = strrchr(name,':');
+ const char *s = strrchr(name,':');
if (s)
s++;
else
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:
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";
/* is this op a FH constructor? */
if (is_handle_constructor(o,numargs)) {
- char *name = Nullch;
+ const char *name = Nullch;
STRLEN len = 0;
flags = 0;
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) ||
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),
-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;
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;
PADLIST *
Perl_pad_new(pTHX_ int flags)
{
- AV *padlist, *padname, *pad, *a0;
+ AV *padlist, *padname, *pad;
ASSERT_CURPAD_LEGAL("pad_new");
* 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;
Perl_pad_undef(pTHX_ CV* cv)
{
I32 ix;
- PADLIST *padlist = CvPADLIST(cv);
+ const PADLIST *padlist = CvPADLIST(cv);
if (!padlist)
return;
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];
*/
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);
}
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"
/* 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;
*/
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,
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)
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;
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))
{
{
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),
}
/* "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)
{
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");
);
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]);
Perl_pad_tidy(pTHX_ padtidy_type type)
{
PADOFFSET ix;
- CV *cv;
ASSERT_CURPAD_ACTIVE("pad_tidy");
*/
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 */
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) {
);
for (ix = 1; ix <= AvFILLp(pad_name); ix++) {
- namesv = pname[ix];
+ const SV *namesv = pname[ix];
if (namesv && namesv == &PL_sv_undef) {
namesv = Nullsv;
}
#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,
{
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;
}
}
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);
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) == '&')
{
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;
#if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
-static char *local_patches[] = {
+static const char *local_patches[] = {
NULL
,"DEVEL22511"
,NULL
{
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;
}
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);
* 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);
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;
#endif
(s = PerlEnv_getenv("PERL5OPT")))
{
- char *popt = s;
+ const char *popt = s;
while (isSPACE(*s))
s++;
if (*s == '-' && *(s+1) == 'T') {
*/
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 */
}
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)
}
void
-Perl_magicname(pTHX_ char *sym, char *name, I32 namlen)
+Perl_magicname(pTHX_ const char *sym, const char *name, I32 namlen)
{
register GV *gv;
}
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? */
"\n",
NULL
};
- char **p = usage_msg;
+ const char **p = usage_msg;
PerlIO_printf(PerlIO_stdout(),
"\nUsage: %s [switches] [--] [programfile] [arguments]",
#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)",
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))
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
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);
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;
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++;
#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; */
* 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
}
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)
}
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 */
}
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;
/* Break at all separators */
while (p && *p) {
SV *libdir = NEWSV(55,0);
- char *s;
+ const char *s;
/* skip any consecutive separators */
if (usesep) {
int ret;
dJMPENV;
- while (AvFILL(paramList) >= 0) {
+ while (av_len(paramList) >= 0) {
cv = (CV*)av_shift(paramList);
if (PL_savebegin) {
if (paramList == PL_beginav) {
#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
};
#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] = {
}
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)
PerlLIO_write(dbg, buffer, strlen(buffer));
#else
SV *sv = newSVpvn("", 0);
- char *s;
STRLEN len;
s = CopFILE(PL_curcop);
if (!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);
#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.
* 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;
#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
#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
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;
*++yyvsp = yylval;
#ifdef DEBUGGING
- *++yynsp = (char *)(yytname[yytoken]);
+ *++yynsp = (const char *)(yytname[yytoken]);
#endif
*++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
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
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
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
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
(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
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
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
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
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
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
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
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
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
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
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;
{
dSP; dTARGET;
SV *sv;
- char *pv;
+ const char *pv;
sv = POPs;
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");
GV *gv;
SV *sv;
SV *tmpRef;
- char *elem;
+ const char *elem;
dSP;
STRLEN n_a;
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;
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;
/* 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 */
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))
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)
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);
}
{
dSP; dMARK;
SV *tmpsv;
- char *tmps;
+ const char *tmps;
STRLEN len;
if (SP - MARK != 1) {
dTARGET;
PP(pp_die)
{
dSP; dMARK;
- char *tmps;
+ const char *tmps;
SV *tmpsv;
STRLEN len;
bool multiarg = 0;
GV *gv;
SV *sv;
I32 markoff = MARK - PL_stack_base;
- char *methname;
+ const char *methname;
int how = PERL_MAGIC_tied;
U32 items;
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;
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)
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);
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, ...)
#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, ...)
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
#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)
#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);
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
#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)
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
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);
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);
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; \
/* 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
)
);
- 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;
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++;
}
{
- 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;
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)), "",
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]);
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>",
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,
*/
#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
#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
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,
}
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);
}
}
SvPV_set(sv, s);
- SvLEN_set(sv, newlen);
+ SvLEN_set(sv, newlen);
}
return s;
}
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);
origsv = sv;
sv = (SV*)SvRV(sv);
if (!sv)
- s = "NULLREF";
+ typestr = "NULLREF";
else {
MAGIC *mg;
(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;
*/
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 == '#') {
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))
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;
=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;
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))
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);
*/
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;
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;
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;
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;
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;
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 {
pv1 = SvPV(svrecode, cur1);
}
else {
- pv1 = tpv = (char*)bytes_to_utf8((U8*)pv1, &cur1);
+ pv1 = tpv = (char*)bytes_to_utf8((const U8*)pv1, &cur1);
}
}
}
} 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;
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;
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)
*/
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;
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')))
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 */
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);
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
{
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 */
* 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"))
bool
Perl_sv_derived_from(pTHX_ SV *sv, const char *name)
{
- char *type;
+ const char *type;
HV *stash;
HV *name_stash;
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);
GV **gvp;
GV *gv;
SV *sv;
- char *undef;
+ const char *undef;
if (SvROK(ST(0))) {
sv = (SV*)SvRV(ST(0));
"%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);
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 )
STRLEN c;
if (!len && s)
- len = strlen((char *)s);
+ len = strlen((const char *)s);
send = s + len;
while (x < send) {
STRLEN c;
if (!len && s)
- len = strlen((char *)s);
+ len = strlen((const char *)s);
send = s + len;
while (x < send) {
}
/*
-=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
*/
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)
/* 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))
=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];
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))) {
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");
=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.
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];
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 */
#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)
* (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 */
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 */
#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.
/* 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++) {
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)
{
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)
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;
}
}
{ /* 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))
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;
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;
{
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') {
* 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 ?
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;
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) {
/* 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 */
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);
}
#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 = "";
#ifndef PERL_MICRO
I32
-Perl_setenv_getix(pTHX_ char *nam)
+Perl_setenv_getix(pTHX_ const char *nam)
{
register I32 i, len = strlen(nam);
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--) {
#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;
#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
}
#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 *
}
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);
}
}
else {
- char *vile;
+ const char *vile;
I32 warn_type;
if (gv && io && IoTYPE(io) == IoTYPE_CLOSED) {
Perl_ebcdic_control(pTHX_ int ch)
{
if (ch > 'a') {
- char *ctlp;
+ const char *ctlp;
if (islower(ch))
ch = toupper(ch);
}
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;
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) {
buf = NULL;
break;
}
- bufsize *= 2;
- Renew(buf, bufsize, char);
+ Renew(buf, bufsize*2, char);
}
return buf;
}
*/
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 */
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) == '_' ) {
}
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) {
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)
EOP
if test X"$args" != "X" ; then
- echo " char *file = __FILE__;"
+ echo " const char file[] = __FILE__;"
echo " dXSUB_SYS;"
ai=''
void
Perl_boot_core_xsutils(pTHX)
{
- char *file = __FILE__;
+ const char file[] = __FILE__;
newXS("attributes::bootstrap", XS_attributes_bootstrap, file);
}
XS(XS_attributes_bootstrap)
{
dXSARGS;
- char *file = __FILE__;
+ const char file[] = __FILE__;
if( items > 1 )
Perl_croak(aTHX_ "Usage: attributes::bootstrap $module");