summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2005-03-25 11:14:09 -0600
committerNicholas Clark <nick@ccl4.org>2005-03-25 23:46:22 +0000
commitdd374669df59cc2457708a01ea0f6d332912530b (patch)
treec085cf838d250f49dfc8f9bc949862489e3b3ad8 /perl.c
parentbd5f3bc473acbb69a352d57b0baf5d694577ad8e (diff)
downloadperl-dd374669df59cc2457708a01ea0f6d332912530b.tar.gz
Consting five
Message-ID: <20050325231409.GB17660@petdance.com> [with modification - the extra argument to incpush was supposed to be being used] p4raw-id: //depot/perl@24081
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/perl.c b/perl.c
index 4a925b0b7b..9d3ecf4ca7 100644
--- a/perl.c
+++ b/perl.c
@@ -1412,8 +1412,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
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;
@@ -1482,11 +1483,11 @@ print \" \\@INC:\\n @INC\\n\";");
}
/* 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--;
@@ -1611,7 +1612,7 @@ print \" \\@INC:\\n @INC\\n\";");
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);
}
@@ -1819,7 +1820,7 @@ perl_run(pTHXx)
}
-STATIC void *
+STATIC void
S_run_body(pTHX_ I32 oldscope)
{
DEBUG_r(PerlIO_printf(Perl_debug_log, "%s $` $& $' support.\n",
@@ -1863,7 +1864,6 @@ S_run_body(pTHX_ I32 oldscope)
my_exit(0);
/* NOTREACHED */
- return NULL;
}
/*
@@ -2191,7 +2191,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
}
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)
@@ -2531,7 +2531,7 @@ Perl_moreswitches(pTHX_ char *s)
}
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;
@@ -2588,7 +2588,7 @@ Perl_moreswitches(pTHX_ char *s)
#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),
@@ -3016,7 +3016,7 @@ S_init_main_stash(pTHX)
/* 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;
@@ -3033,7 +3033,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
}
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;
@@ -3063,7 +3063,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
}
scriptname = savepv(s + 1);
Safefree(PL_origfilename);
- PL_origfilename = scriptname;
+ PL_origfilename = (char *)scriptname;
}
}
}
@@ -3071,7 +3071,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
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)
@@ -3098,7 +3098,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
}
#else /* IAMSUID */
else if (PL_preprocess) {
- char *cpp_cfg = CPPSTDIN;
+ const char *cpp_cfg = CPPSTDIN;
SV *cpp = newSVpvn("",0);
SV *cmd = NEWSV(0,0);
@@ -3158,7 +3158,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
"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);
}
@@ -3712,12 +3712,15 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
/* 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
@@ -3842,6 +3845,7 @@ Perl_doing_taint(int argc, char *argv[], char *envp[])
&& (argv[1][1] == 't' || argv[1][1] == 'T') )
return 1;
return 0;
+ (void)envp;
}
STATIC void
@@ -4298,10 +4302,11 @@ S_incpush_if_exists(pTHX_ SV *dir)
}
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;
@@ -4343,6 +4348,9 @@ S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep,
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 .../
@@ -4360,7 +4368,6 @@ S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep,
* 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)) {
@@ -4437,8 +4444,8 @@ S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep,
}
SvREFCNT_dec(prefix_sv);
}
- }
#endif
+ }
/*
* BEFORE pushing libdir onto @INC we may first push version- and
* archname-specific sub-directories.
@@ -4596,7 +4603,7 @@ void
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;
@@ -4763,6 +4770,9 @@ static I32
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);