Perl_av_make(pTHX_ register I32 size, register SV **strp)
{
register AV *av;
- register I32 i;
- register SV** ary;
av = (AV*)NEWSV(8,0);
sv_upgrade((SV *) av,SVt_PVAV);
AvFLAGS(av) = AVf_REAL;
if (size) { /* `defined' was returning undef for size==0 anyway. */
+ register SV** ary;
+ register I32 i;
New(4,ary,size,SV*);
AvALLOC(av) = ary;
SvPVX(av) = (char*)ary;
Perl_av_clear(pTHX_ register AV *av)
{
register I32 key;
- SV** ary;
#ifdef DEBUGGING
if (SvREFCNT(av) == 0 && ckWARN_d(WARN_DEBUGGING)) {
return;
if (AvREAL(av)) {
- ary = AvARRAY(av);
+ SV** ary = AvARRAY(av);
key = AvFILLp(av) + 1;
while (key) {
SV * sv = ary[--key];
#if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
s |void |find_beginning
s |void |forbid_setid |const char * s
-s |void |incpush |const char *|int|int|int|int
+s |void |incpush |const char *dir|bool addsubdirs|bool addoldvers|bool usesep|bool canrelocate
s |void |init_interp
s |void |init_ids
s |void |init_lexer
s |void |init_predump_symbols
rs |void |my_exit_jump
s |void |nuke_stacks
-s |void |open_script |char *|bool|SV *
-s |void |usage |const char *
+s |void |open_script |const char *scriptname|bool dosearch|SV *sv
+s |void |usage |const char *name
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 |const OP *myop|int is_eval
+rs |void |run_body |I32 oldscope
+s |void |call_body |const OP *myop|bool is_eval
s |void* |call_list_body |CV *cv
#endif
/* SaveError() takes printf style args and saves the result in dl_last_error */
static void
-SaveError(pTHX_ char* pat, ...)
+SaveError(pTHX_ const char* pat, ...)
{
dMY_CXT;
va_list args;
SV *msv;
- char *message;
+ const char *message;
STRLEN len;
/* This code is based on croak/warn, see mess() in util.c */
I32 len;
register const char *namend;
HV *stash = 0;
- I32 add = flags & ~SVf_UTF8;
+ const I32 add = flags & ~SVf_UTF8;
+ (void)full_len;
if (*name == '*' && isALPHA(name[1])) /* accidental stringify on a GV? */
name++;
}
CopLINE_set(PL_curcop, GvLINE(gv));
#ifdef USE_ITHREADS
- CopFILE(PL_curcop) = file; /* set for warning */
+ CopFILE(PL_curcop) = (char *)file; /* set for warning */
#else
CopFILEGV(PL_curcop) = gv_fetchfile(file);
#endif
Perl_magic_freeovrld(pTHX_ SV *sv, MAGIC *mg)
{
AMT *amtp = (AMT*)mg->mg_ptr;
+ (void)sv;
+
if (amtp && AMT_AMAGIC(amtp)) {
int i;
for (i = 1; i < NofAMmeth; i++) {
bool
Perl_is_gv_magical(pTHX_ const char *name, STRLEN len, U32 flags)
{
+ (void)flags;
if (len > 1) {
const char *name1 = name + 1;
switch (*name) {
PERLVAR(Iminus_c, bool)
PERLVAR(Ipatchlevel, SV *)
PERLVAR(Ilocalpatches, const char **)
-PERLVARI(Isplitstr, char *, " ")
+PERLVARI(Isplitstr, const char *, " ")
PERLVAR(Ipreprocess, bool)
PERLVAR(Iminus_n, bool)
PERLVAR(Iminus_p, bool)
PERLVAR(Iosname, char *) /* operating system */
/* For binary compatibility with older versions only */
-PERLVARI(Ish_path_compat, char *, SH_PATH)/* full path of shell */
+PERLVARI(Ish_path_compat, const char *, SH_PATH)/* full path of shell */
PERLVAR(Isighandlerp, Sighandler_t)
PERLVAR(Isv_yes, SV)
#ifdef CSH
-PERLVARI(Icshname, char *, CSH)
+PERLVARI(Icshname, const char *, CSH)
PERLVARI(Icshlen, I32, 0)
#endif
}
#endif /* USE_LOCALE_CTYPE */
+ (void)newctype;
}
/*
This is an alternative to using the -C command line switch
(the -C if present will override this). */
{
- char *p = PerlEnv_getenv("PERL_UNICODE");
+ const char *p = PerlEnv_getenv("PERL_UNICODE");
PL_unicode = p ? parse_unicode_opts(&p) : 0;
}
#endif
Perl_magic_regdata_cnt(pTHX_ SV *sv, MAGIC *mg)
{
register const REGEXP *rx;
+ (void)sv;
if (PL_curpm && (rx = PM_GETRE(PL_curpm))) {
if (mg->mg_obj) /* @+ */
int
Perl_magic_regdatum_set(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)sv; (void)mg;
Perl_croak(aTHX_ PL_no_modify);
/* NOT REACHED */
- (void)sv; (void)mg;
- return 0;
}
U32
{
register I32 paren;
register I32 i;
- register REGEXP *rx;
+ register const REGEXP *rx;
I32 s1, t1;
switch (*mg->mg_ptr) {
Perl_magic_clearenv(pTHX_ SV *sv, MAGIC *mg)
{
STRLEN n_a;
+ (void)sv;
my_setenv(MgPV(mg,n_a),Nullch);
return 0;
}
# endif /* PERL_IMPLICIT_SYS || WIN32 */
#endif /* VMS || EPOC */
#endif /* !PERL_MICRO */
+ (void)sv;
+ (void)mg;
return 0;
}
* refactoring might be in order.
*/
STRLEN n_a;
- SV* to_dec;
register const char *s = MgPV(mg,n_a);
+ (void)sv;
if (*s == '_') {
SV** svp;
if (strEQ(s,"__DIE__"))
else
Perl_croak(aTHX_ "No such hook: %s", s);
if (*svp) {
- to_dec = *svp;
+ SV *to_dec = *svp;
*svp = 0;
SvREFCNT_dec(to_dec);
}
PL_psig_name[i]=0;
}
if(PL_psig_ptr[i]) {
- to_dec=PL_psig_ptr[i];
+ SV *to_dec=PL_psig_ptr[i];
PL_psig_ptr[i]=0;
LEAVE;
SvREFCNT_dec(to_dec);
return 0;
}
-void
-Perl_raise_signal(pTHX_ int sig)
+static void
+S_raise_signal(pTHX_ int sig)
{
/* Set a flag to say this signal is pending */
PL_psig_pend[sig]++;
* with risk we may be in malloc() etc. */
(*PL_sighandlerp)(sig);
else
- Perl_raise_signal(aTHX_ sig);
+ S_raise_signal(aTHX_ sig);
}
#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
int
Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)sv;
+ (void)mg;
PL_sub_generation++;
return 0;
}
int
Perl_magic_setamagic(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)sv;
+ (void)mg;
/* HV_badAMAGIC_on(Sv_STASH(sv)); */
PL_amagic_generation++;
int
Perl_magic_getnkeys(pTHX_ SV *sv, MAGIC *mg)
{
- HV *hv = (HV*)LvTARG(sv);
+ HV * const hv = (HV*)LvTARG(sv);
I32 i = 0;
+ (void)mg;
if (hv) {
(void) hv_iterinit(hv);
int
Perl_magic_setnkeys(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)mg;
if (LvTARG(sv)) {
hv_ksplit((HV*)LvTARG(sv), SvIV(sv));
}
int
Perl_magic_getglob(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)mg;
if (SvFAKE(sv)) { /* FAKE globs can get coerced */
SvFAKE_off(sv);
gv_efullname3(sv,((GV*)sv), "*");
Perl_magic_setglob(pTHX_ SV *sv, MAGIC *mg)
{
GV* gv;
+ (void)mg;
if (!SvOK(sv))
return 0;
const char * const tmps = SvPV(lsv,len);
I32 offs = LvTARGOFF(sv);
I32 rem = LvTARGLEN(sv);
+ (void)mg;
if (SvUTF8(lsv))
sv_pos_u2b(lsv, &offs, &rem);
{
STRLEN len;
char *tmps = SvPV(sv, len);
- SV *lsv = LvTARG(sv);
+ SV * const lsv = LvTARG(sv);
I32 lvoff = LvTARGOFF(sv);
I32 lvlen = LvTARGLEN(sv);
+ (void)mg;
if (DO_UTF8(sv)) {
sv_utf8_upgrade(lsv);
int
Perl_magic_settaint(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)sv;
if (PL_localizing) {
if (PL_localizing == 1)
mg->mg_len <<= 1;
Perl_magic_getvec(pTHX_ SV *sv, MAGIC *mg)
{
SV * const lsv = LvTARG(sv);
+ (void)mg;
if (!lsv) {
SvOK_off(sv);
int
Perl_magic_setvec(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)mg;
do_vecset(sv); /* XXX slurp this routine */
return 0;
}
int
Perl_magic_setdefelem(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)mg;
if (LvTARGLEN(sv))
vivify_defelem(sv);
if (LvTARG(sv)) {
AV *av = (AV*)mg->mg_obj;
SV **svp = AvARRAY(av);
I32 i = AvFILLp(av);
+ (void)sv;
+
while (i >= 0) {
if (svp[i]) {
if (!SvWEAKREF(svp[i]))
int
Perl_magic_setbm(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)mg;
sv_unmagic(sv, PERL_MAGIC_bm);
SvVALID_off(sv);
return 0;
int
Perl_magic_setfm(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)mg;
sv_unmagic(sv, PERL_MAGIC_fm);
SvCOMPILED_off(sv);
return 0;
int
Perl_magic_setregexp(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)mg;
sv_unmagic(sv, PERL_MAGIC_qr);
return 0;
}
{
regexp *re = (regexp *)mg->mg_obj;
ReREFCNT_dec(re);
+ (void)sv;
return 0;
}
* RenE<eacute> Descartes said "I think not."
* and vanished with a faint plop.
*/
+ (void)sv;
if (mg->mg_ptr) {
Safefree(mg->mg_ptr);
mg->mg_ptr = NULL;
int
Perl_magic_setutf8(pTHX_ SV *sv, MAGIC *mg)
{
+ (void)sv;
Safefree(mg->mg_ptr); /* The mg_ptr holds the pos cache. */
mg->mg_ptr = 0;
mg->mg_len = -1; /* The mg_len holds the len cache. */
main(int argc, char **argv, char **env)
{
int exitstatus;
+ (void)env;
#ifndef PERL_USE_SAFE_PUTENV
PL_use_safe_putenv = 0;
#endif /* PERL_USE_SAFE_PUTENV */
}
CvGV(cv) = gv;
(void)gv_fetchfile(filename);
- CvFILE(cv) = filename; /* NOTE: not copied, as it is expected to be
+ CvFILE(cv) = (char *)filename; /* NOTE: not copied, as it is expected to be
an external constant string */
CvXSUB(cv) = subaddr;
while (SvCUR(PL_Sv) > opts+76) {
/* find last space after "options: " and before col 76 */
- char *space, *pv = SvPV_nolen(PL_Sv);
- char c = pv[opts+76];
+ const char *space;
+ char *pv = SvPV_nolen(PL_Sv);
+ const char c = pv[opts+76];
pv[opts+76] = '\0';
space = strrchr(pv+opts+26, ' ');
pv[opts+76] = c;
}
/* catch use of gnu style long options */
if (strEQ(s, "version")) {
- s = "v";
+ s = (char *)"v";
goto reswitch;
}
if (strEQ(s, "help")) {
- s = "h";
+ s = (char *)"h";
goto reswitch;
}
s--;
if (PL_doextract) {
#endif
find_beginning();
- if (cddir && PerlDir_chdir(cddir) < 0)
+ if (cddir && PerlDir_chdir( (char *)cddir ) < 0)
Perl_croak(aTHX_ "Can't chdir to %s",cddir);
}
}
-STATIC void *
+STATIC void
S_run_body(pTHX_ I32 oldscope)
{
DEBUG_r(PerlIO_printf(Perl_debug_log, "%s $` $& $' support.\n",
my_exit(0);
/* NOTREACHED */
- return NULL;
}
/*
}
STATIC void
-S_call_body(pTHX_ const OP *myop, int is_eval)
+S_call_body(pTHX_ const OP *myop, bool is_eval)
{
if (PL_op == myop) {
if (is_eval)
}
case 'C':
s++;
- PL_unicode = parse_unicode_opts(&s);
+ PL_unicode = parse_unicode_opts( (const char **)&s );
return s;
case 'F':
PL_minus_F = TRUE;
#ifdef DEBUGGING
forbid_setid("-D");
s++;
- PL_debug = get_debug_opts(&s, 1) | DEBUG_TOP_FLAG;
+ PL_debug = get_debug_opts( (const char **)&s, 1) | DEBUG_TOP_FLAG;
#else /* !DEBUGGING */
if (ckWARN_d(WARN_DEBUGGING))
Perl_warner(aTHX_ packWARN(WARN_DEBUGGING),
/* PSz 18 Nov 03 fdscript now global but do not change prototype */
STATIC void
-S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
+S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv)
{
#ifndef IAMSUID
const char *quote;
}
else {
/* if find_script() returns, it returns a malloc()-ed value */
- PL_origfilename = scriptname = find_script(scriptname, dosearch, NULL, 1);
+ scriptname = PL_origfilename = find_script(scriptname, dosearch, NULL, 1);
if (strnEQ(scriptname, "/dev/fd/", 8) && isDIGIT(scriptname[8]) ) {
const char *s = scriptname + 8;
}
scriptname = savepv(s + 1);
Safefree(PL_origfilename);
- PL_origfilename = scriptname;
+ PL_origfilename = (char *)scriptname;
}
}
}
CopFILE_free(PL_curcop);
CopFILE_set(PL_curcop, PL_origfilename);
if (*PL_origfilename == '-' && PL_origfilename[1] == '\0')
- scriptname = "";
+ scriptname = (char *)"";
if (PL_fdscript >= 0) {
PL_rsfp = PerlIO_fdopen(PL_fdscript,PERL_SCRIPT_MODE);
# if defined(HAS_FCNTL) && defined(F_SETFD)
}
#else /* IAMSUID */
else if (PL_preprocess) {
- char *cpp_cfg = CPPSTDIN;
+ const char *cpp_cfg = CPPSTDIN;
SV *cpp = newSVpvn("",0);
SV *cmd = NEWSV(0,0);
"PL_preprocess: cmd=\"%s\"\n",
SvPVX(cmd)));
- PL_rsfp = PerlProc_popen(SvPVX(cmd), "r");
+ PL_rsfp = PerlProc_popen(SvPVX(cmd), (char *)"r");
SvREFCNT_dec(cmd);
SvREFCNT_dec(cpp);
}
/* not set-id, must be wrapped */
}
#endif /* DOSUID */
+ (void)validarg;
+ (void)scriptname;
}
STATIC void
S_find_beginning(pTHX)
{
- register char *s, *s2;
+ register char *s;
+ register const char *s2;
#ifdef MACOS_TRADITIONAL
int maclines = 0;
#endif
&& (argv[1][1] == 't' || argv[1][1] == 'T') )
return 1;
return 0;
+ (void)envp;
}
STATIC void
}
STATIC void
-S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep,
- int canrelocate)
+S_incpush(pTHX_ const char *dir, bool addsubdirs, bool addoldvers, bool usesep,
+ bool canrelocate)
{
SV *subdir = Nullsv;
+ const char *p = dir;
if (!p || !*p)
return;
sv_catpv(libdir, ":");
#endif
+ /* Do the if() outside the #ifdef to avoid warnings about an unused
+ parameter. */
+ if (canrelocate) {
#ifdef PERL_RELOCATABLE_INC
/*
* Relocatable include entries are marked with a leading .../
* The intent is that /usr/local/bin/perl and .../../lib/perl5
* generates /usr/local/lib/perl5
*/
- {
char *libpath = SvPVX(libdir);
STRLEN libpath_len = SvCUR(libdir);
if (libpath_len >= 4 && memEQ (libpath, ".../", 4)) {
}
SvREFCNT_dec(prefix_sv);
}
- }
#endif
+ }
/*
* BEFORE pushing libdir onto @INC we may first push version- and
* archname-specific sub-directories.
Perl_call_list(pTHX_ I32 oldscope, AV *paramList)
{
SV *atsv;
- line_t oldline = CopLINE(PL_curcop);
+ const line_t oldline = CopLINE(PL_curcop);
CV *cv;
STRLEN len;
int ret;
read_e_script(pTHX_ int idx, SV *buf_sv, int maxlen)
{
char *p, *nl;
+ (void)idx;
+ (void)maxlen;
+
p = SvPVX(PL_e_script);
nl = strchr(p, '\n');
nl = (nl) ? nl+1 : SvEND(PL_e_script);
mode = "rb";
else if (PL_op->op_private & OPpOPEN_IN_CRLF)
mode = "rt";
- fp = PerlProc_popen(tmps, mode);
+ fp = PerlProc_popen(tmps, (char *)mode);
if (fp) {
const char *type = NULL;
if (PL_curcop->cop_io) {
if ((IoFLAGS(io) & IOf_START) && av_len(GvAVn(gv)) < 0) {
IoLINES(io) = 0;
IoFLAGS(io) &= ~IOf_START;
- do_open(gv, "-", 1, FALSE, O_RDONLY, 0, Nullfp);
+ do_open(gv, (char *)"-", 1, FALSE, O_RDONLY, 0, Nullfp);
sv_setpvn(GvSV(gv), "-", 1);
SvSETMAGIC(GvSV(gv));
}
#if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
STATIC void S_find_beginning(pTHX);
STATIC void S_forbid_setid(pTHX_ const char * s);
-STATIC void S_incpush(pTHX_ const char *, int, int, int, int);
+STATIC void S_incpush(pTHX_ const char *dir, bool addsubdirs, bool addoldvers, bool usesep, bool canrelocate);
STATIC void S_init_interp(pTHX);
STATIC void S_init_ids(pTHX);
STATIC void S_init_lexer(pTHX);
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_ const char *);
+STATIC void S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv);
+STATIC void S_usage(pTHX_ const char *name);
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_ const OP *myop, int is_eval);
+STATIC void S_run_body(pTHX_ I32 oldscope) __attribute__((noreturn));
+STATIC void S_call_body(pTHX_ const OP *myop, bool is_eval);
STATIC void* S_call_list_body(pTHX_ CV *cv);
#endif
PL_colors[i] = ++s;
}
else
- PL_colors[i] = s = "";
+ PL_colors[i] = s = (char *)"";
}
} else {
while (i < 6)
PERLVAR(Tlast_in_gv, GV *) /* GV used in last <FH> */
PERLVAR(Tofs_sv, SV *) /* output field separator $, */
PERLVAR(Tdefoutgv, GV *) /* default FH for output */
-PERLVARI(Tchopset, char *, " \n-") /* $: */
+PERLVARI(Tchopset, const char *, " \n-") /* $: */
PERLVAR(Tformtarget, SV *)
PERLVAR(Tbodytarget, SV *)
PERLVAR(Ttoptarget, SV *)
/* The count here deliberately includes the NUL
that terminates the C string constant. This
embeds the opening NUL into the string. */
+ const char *splits = PL_splitstr;
sv_catpvn(PL_linestr, "our @F=split(q", 15);
- s = PL_splitstr;
do {
/* Need to \ \s */
- if (*s == '\\')
- sv_catpvn(PL_linestr, s, 1);
- sv_catpvn(PL_linestr, s, 1);
- } while (*s++);
+ if (*splits == '\\')
+ sv_catpvn(PL_linestr, splits, 1);
+ sv_catpvn(PL_linestr, splits, 1);
+ } while (*splits++);
/* This loop will embed the trailing NUL of
PL_linestr as the last thing it does before
terminating. */