Third consting batch
[p5sagit/p5-mst-13.2.git] / perl.c
diff --git a/perl.c b/perl.c
index 86b7e2a..4b1ee08 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -359,7 +359,7 @@ perl_destruct(pTHXx)
     {
        char *s;
        if ((s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL"))) {
-           int i = atoi(s);
+            const int i = atoi(s);
            if (destruct_level < i)
                destruct_level = i;
        }
@@ -980,7 +980,7 @@ Perl_call_atexit(pTHX_ ATEXIT_t fn, void *ptr)
    bytes of stack longer than necessary
  */
 STATIC void
-S_procself_val(pTHX_ SV *sv, char *arg0)
+S_procself_val(pTHX_ SV *sv, const char *arg0)
 {
     char buf[MAXPATHLEN];
     int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1);
@@ -1081,7 +1081,7 @@ setuid perl scripts securely.\n");
         * the area we are able to modify is limited to the size of
         * the original argv[0].  (See below for 'contiguous', though.)
         * --jhi */
-        char *s = NULL;
+        const char *s = NULL;
         int i;
         UV mask =
           ~(UV)(PTRSIZE == 4 ? 3 : PTRSIZE == 8 ? 7 : PTRSIZE == 16 ? 15 : 0);
@@ -1222,13 +1222,13 @@ STATIC void *
 S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
 {
     int argc = PL_origargc;
-    char **argv = PL_origargv;
-    char *scriptname = NULL;
+    const char **argv = PL_origargv;
+    const char *scriptname = NULL;
     VOL bool dosearch = FALSE;
-    char *validarg = "";
+    const char *validarg = "";
     register SV *sv;
     register char *s;
-    char *cddir = Nullch;
+    const char *cddir = Nullch;
     bool minus_f = FALSE;
 
     PL_fdscript = -1;
@@ -1503,7 +1503,7 @@ print \"  \\@INC:\\n    @INC\\n\";");
 #endif
        (s = PerlEnv_getenv("PERL5OPT")))
     {
-       char *popt = s;
+       const char *popt = s;
        while (isSPACE(*s))
            s++;
        if (*s == '-' && *(s+1) == 'T') {
@@ -1986,7 +1986,7 @@ Performs a callback to the specified Perl sub.  See L<perlcall>.
 */
 
 I32
-Perl_call_argv(pTHX_ const char *sub_name, I32 flags, register char **argv)
+Perl_call_argv(pTHX_ const char *sub_name, I32 flags, register const char **argv)
 
                        /* See G_* flags in cop.h */
                        /* null terminated arg list */
@@ -2191,7 +2191,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
 }
 
 STATIC void
-S_call_body(pTHX_ OP *myop, int is_eval)
+S_call_body(pTHX_ const OP *myop, int is_eval)
 {
     if (PL_op == myop) {
        if (is_eval)
@@ -2360,7 +2360,7 @@ Perl_require_pv(pTHX_ const char *pv)
 }
 
 void
-Perl_magicname(pTHX_ char *sym, char *name, I32 namlen)
+Perl_magicname(pTHX_ const char *sym, const char *name, I32 namlen)
 {
     register GV *gv;
 
@@ -2369,7 +2369,7 @@ Perl_magicname(pTHX_ char *sym, char *name, I32 namlen)
 }
 
 STATIC void
-S_usage(pTHX_ char *name)              /* XXX move this out into a module ? */
+S_usage(pTHX_ const char *name)                /* XXX move this out into a module ? */
 {
     /* This message really ought to be max 23 lines.
      * Removed -h because the user already knows that option. Others? */
@@ -2406,7 +2406,7 @@ S_usage(pTHX_ char *name)         /* XXX move this out into a module ? */
 "\n",
 NULL
 };
-    char **p = usage_msg;
+    const char **p = usage_msg;
 
     PerlIO_printf(PerlIO_stdout(),
                  "\nUsage: %s [switches] [--] [programfile] [arguments]",
@@ -2420,7 +2420,7 @@ NULL
 
 #ifdef DEBUGGING
 int
-Perl_get_debug_opts(pTHX_ char **s, bool givehelp)
+Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
 {
     static const char *usage_msgd[] = {
       " Debugging flag values: (see also -d)",
@@ -2455,7 +2455,7 @@ Perl_get_debug_opts(pTHX_ char **s, bool givehelp)
        static const char debopts[] = "psltocPmfrxu HXDSTRJvCAq";
 
        for (; isALNUM(**s); (*s)++) {
-           char *d = strchr(debopts,**s);
+           const char *d = strchr(debopts,**s);
            if (d)
                i |= 1 << (d - debopts);
            else if (ckWARN_d(WARN_DEBUGGING))
@@ -2468,7 +2468,7 @@ Perl_get_debug_opts(pTHX_ char **s, bool givehelp)
        for (; isALNUM(**s); (*s)++) ;
     }
     else if (givehelp) {
-      char **p = usage_msgd;
+      const char **p = usage_msgd;
       while (*p) PerlIO_printf(PerlIO_stdout(), "%s\n", *p++);
     }
 #  ifdef EBCDIC
@@ -2690,7 +2690,7 @@ Perl_moreswitches(pTHX_ char *s)
        if (*++s) {
            char *start;
            SV *sv;
-           char *use = "use ";
+           const char *use = "use ";
            /* -M-foo == 'no foo'       */
            if (*s == '-') { use = "no "; ++s; }
            sv = newSVpv(use,0);
@@ -3019,10 +3019,10 @@ STATIC void
 S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
 {
 #ifndef IAMSUID
-    char *quote;
-    char *code;
-    char *cpp_discard_flag;
-    char *perl;
+    const char *quote;
+    const char *code;
+    const char *cpp_discard_flag;
+    const char *perl;
 #endif
 
     PL_fdscript = -1;
@@ -3036,7 +3036,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
        PL_origfilename = scriptname = find_script(scriptname, dosearch, NULL, 1);
 
        if (strnEQ(scriptname, "/dev/fd/", 8) && isDIGIT(scriptname[8]) ) {
-           char *s = scriptname + 8;
+            const char *s = scriptname + 8;
            PL_fdscript = atoi(s);
            while (isDIGIT(*s))
                s++;
@@ -3318,7 +3318,7 @@ S_fd_on_nosuid_fs(pTHX_ int fd)
 #endif /* IAMSUID */
 
 STATIC void
-S_validate_suid(pTHX_ char *validarg, char *scriptname)
+S_validate_suid(pTHX_ const char *validarg, const char *scriptname)
 {
 #ifdef IAMSUID
     /* int which; */
@@ -3812,7 +3812,7 @@ S_init_ids(pTHX)
  * before even the options are parsed, so PL_tainting has
  * not been initialized properly.  */
 bool
-Perl_doing_taint(int argc, char *argv[], char *envp[])
+Perl_doing_taint(int argc, const char *argv[], const char *envp[])
 {
 #ifndef PERL_IMPLICIT_SYS
     /* If we have PERL_IMPLICIT_SYS we can't call getuid() et alia
@@ -3845,7 +3845,7 @@ Perl_doing_taint(int argc, char *argv[], char *envp[])
 }
 
 STATIC void
-S_forbid_setid(pTHX_ char *s)
+S_forbid_setid(pTHX_ const char *s)
 {
 #ifdef SETUID_SCRIPTS_ARE_SECURE_NOW
     if (PL_euid != PL_uid)
@@ -4020,7 +4020,7 @@ S_init_predump_symbols(pTHX)
 }
 
 void
-Perl_init_argv_symbols(pTHX_ register int argc, register char **argv)
+Perl_init_argv_symbols(pTHX_ register int argc, register const char **argv)
 {
     char *s;
     argc--,argv++;     /* skip name of script */
@@ -4298,7 +4298,7 @@ S_incpush_if_exists(pTHX_ SV *dir)
 }
 
 STATIC void
-S_incpush(pTHX_ char *p, int addsubdirs, int addoldvers, int usesep,
+S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep,
          int canrelocate)
 {
     SV *subdir = Nullsv;
@@ -4313,7 +4313,7 @@ S_incpush(pTHX_ char *p, int addsubdirs, int addoldvers, int usesep,
     /* Break at all separators */
     while (p && *p) {
        SV *libdir = NEWSV(55,0);
-       char *s;
+        const char *s;
 
        /* skip any consecutive separators */
        if (usesep) {
@@ -4602,7 +4602,7 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList)
     int ret;
     dJMPENV;
 
-    while (AvFILL(paramList) >= 0) {
+    while (av_len(paramList) >= 0) {
        cv = (CV*)av_shift(paramList);
        if (PL_savebegin) {
            if (paramList == PL_beginav) {