diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-10-06 23:44:50 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-10-06 23:44:50 +0000 |
commit | c7030b8198b0e74c565e901a90ca7061aebbf5ad (patch) | |
tree | 7ad301c3f4381c8e753625e5f353302cb3932f45 /perl.c | |
parent | f0d36289ce76f882218c0a53cd52f716a167e5bb (diff) | |
download | perl-c7030b8198b0e74c565e901a90ca7061aebbf5ad.tar.gz |
Finally! Worked out how to const Perl_moreswitches().
Although I've committed crimes against indenting to avoid losing
blame annotation history. Revisit this when we have version control
that can easily see through whitespace changes.
[Can probably now propagate consting inside S_parse_body(),
Perl_moreswitches() and Perl_yylex(), but that will not affect the
external API, so can wait until after 5.10]
p4raw-id: //depot/perl@32057
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -1686,7 +1686,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) VOL bool dosearch = FALSE; const char *validarg = ""; register SV *sv; - register char *s, c; + register char c; const char *cddir = NULL; #ifdef USE_SITECUSTOMIZE bool minus_f = FALSE; @@ -1701,6 +1701,8 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) SAVEFREESV(sv); init_main_stash(); + { + const char *s; for (argc--,argv++; argc > 0; argc--,argv++) { if (argv[0][0] != '-' || !argv[0][1]) break; @@ -1953,8 +1955,13 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) Perl_croak(aTHX_ "Unrecognized switch: -%s (-h will show valid options)",s); } } + } + switch_end: + { + char *s; + if ( #ifndef SECURE_INTERNAL_GETENV !PL_tainting && @@ -2007,6 +2014,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) } } } + } #ifdef USE_SITECUSTOMIZE if (!minus_f) { @@ -2159,6 +2167,8 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) } } + { + const char *s; if ((s = PerlEnv_getenv("PERL_SIGNALS"))) { if (strEQ(s, "unsafe")) PL_signals |= PERL_SIGNALS_UNSAFE_FLAG; @@ -2167,8 +2177,11 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) else Perl_croak(aTHX_ "PERL_SIGNALS illegal: \"%s\"", s); } + } #ifdef PERL_MAD + { + const char *s; if ((s = PerlEnv_getenv("PERL_XMLDUMP"))) { PL_madskills = 1; PL_minus_c = 1; @@ -2181,10 +2194,15 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) } my_setenv("PERL_XMLDUMP", NULL); /* hide from subprocs */ } + } + + { + const char *s; if ((s = PerlEnv_getenv("PERL_MADSKILLS"))) { PL_madskills = atoi(s); my_setenv("PERL_MADSKILLS", NULL); /* hide from subprocs */ } + } #endif lex_start(linestr_sv, rsfp, TRUE); @@ -2944,8 +2962,8 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp) /* This routine handles any switches that can be given during run */ -char * -Perl_moreswitches(pTHX_ char *s) +const char * +Perl_moreswitches(pTHX_ const char *s) { dVAR; UV rschar; @@ -3092,7 +3110,7 @@ Perl_moreswitches(pTHX_ char *s) while (*s && isSPACE(*s)) ++s; if (*s) { - char *e, *p; + const char *e, *p; p = s; /* ignore trailing spaces (possibly followed by other switches) */ do { @@ -3141,7 +3159,7 @@ Perl_moreswitches(pTHX_ char *s) case 'm': forbid_setid('m', -1); /* XXX ? */ if (*++s) { - char *start; + const char *start; SV *sv; const char *use = "use "; /* -M-foo == 'no foo' */ @@ -4251,7 +4269,7 @@ STATIC void S_find_beginning(pTHX_ SV* linestr_sv, PerlIO *rsfp) { dVAR; - register char *s; + const char *s; register const char *s2; #ifdef MACOS_TRADITIONAL int maclines = 0; |