X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/fb435042519b322b439cfd0b0b4918acd34d30db..44b2d6d61b5b1b85de1be347091e97d57de8ae0c:/perl.c diff --git a/perl.c b/perl.c index 7cd0272..478b415 100644 --- a/perl.c +++ b/perl.c @@ -137,7 +137,7 @@ Perl_sys_init3(int* argc, char*** argv, char*** env) } void -Perl_sys_term() +Perl_sys_term(void) { dVAR; if (!PL_veto_cleanup) { @@ -306,11 +306,6 @@ perl_construct(pTHXx) Zero(PL_sv_consts, SV_CONSTS_COUNT, SV*); -#if defined(__DYNAMIC__) && (defined(NeXT) || defined(__NeXT__)) - _dyld_lookup_and_bind - ("__environ", (unsigned long *) &environ_pointer, NULL); -#endif /* environ */ - #ifndef PERL_MICRO # ifdef USE_ENVIRON_ARRAY PL_origenviron = environ; @@ -551,7 +546,12 @@ perl_destruct(pTHXx) { const char * const s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL"); if (s) { - const int i = atoi(s); + int i; + if (strEQ(s, "-1")) { /* Special case: modperl folklore. */ + i = -1; + } else { + i = grok_atou(s, NULL); + } #ifdef DEBUGGING if (destruct_level < i) destruct_level = i; #endif @@ -670,7 +670,7 @@ perl_destruct(pTHXx) msg.msg_name = NULL; msg.msg_namelen = 0; msg.msg_iov = vec; - msg.msg_iovlen = sizeof(vec)/sizeof(vec[0]); + msg.msg_iovlen = C_ARRAY_LENGTH(vec); vec[0].iov_base = (void*)⌖ vec[0].iov_len = sizeof(target); @@ -1031,8 +1031,10 @@ perl_destruct(pTHXx) SvREFCNT_dec(PL_utf8_tofold); SvREFCNT_dec(PL_utf8_idstart); SvREFCNT_dec(PL_utf8_idcont); + SvREFCNT_dec(PL_utf8_foldable); SvREFCNT_dec(PL_utf8_foldclosures); SvREFCNT_dec(PL_AboveLatin1); + SvREFCNT_dec(PL_InBitmap); SvREFCNT_dec(PL_UpperLatin1); SvREFCNT_dec(PL_Latin1); SvREFCNT_dec(PL_NonL1NonFinalFold); @@ -1046,6 +1048,7 @@ perl_destruct(pTHXx) PL_utf8_idcont = NULL; PL_utf8_foldclosures = NULL; PL_AboveLatin1 = NULL; + PL_InBitmap = NULL; PL_HasMultiCharFold = NULL; PL_Latin1 = NULL; PL_NonL1NonFinalFold = NULL; @@ -1361,7 +1364,7 @@ perl_free(pTHXx) PL_debug &= ~ DEBUG_m_FLAG; } while(aTHXx->Imemory_debug_header.next != &(aTHXx->Imemory_debug_header)) - safesysfree(sTHX + (char *)(aTHXx->Imemory_debug_header.next)); + safesysfree(PERL_MEMORY_DEBUG_HEADER_SIZE + (char *)(aTHXx->Imemory_debug_header.next)); PL_debug = old_debug; } } @@ -1419,7 +1422,6 @@ perl_fini(void) void Perl_call_atexit(pTHX_ ATEXIT_t fn, void *ptr) { - dVAR; Renew(PL_exitlist, PL_exitlistlen+1, PerlExitListEntry); PL_exitlist[PL_exitlistlen].fn = fn; PL_exitlist[PL_exitlistlen].ptr = ptr; @@ -1456,7 +1458,7 @@ perl_parse(pTHXx_ XSINIT_t xsinit, int argc, char **argv, char **env) { const char * const s = PerlEnv_getenv("PERL_HASH_SEED_DEBUG"); - if (s && (atoi(s) == 1)) { + if (s && (grok_atou(s, NULL) == 1)) { unsigned char *seed= PERL_HASH_SEED; unsigned char *seed_end= PERL_HASH_SEED + PERL_HASH_SEED_BYTES; PerlIO_printf(Perl_debug_log, "HASH_FUNCTION = %s HASH_SEED = 0x", PERL_HASH_FUNC); @@ -1488,8 +1490,7 @@ perl_parse(pTHXx_ XSINIT_t xsinit, int argc, char **argv, char **env) * --jhi */ const char *s = NULL; int i; - const UV mask = - ~(UV)(PTRSIZE == 4 ? 3 : PTRSIZE == 8 ? 7 : PTRSIZE == 16 ? 15 : 0); + const UV mask = ~(UV)(PTRSIZE-1); /* Do the mask check only if the args seem like aligned. */ const UV aligned = (mask < ~(UV)0) && ((PTR2UV(argv[0]) & mask) == PTR2UV(argv[0])); @@ -1608,7 +1609,7 @@ perl_parse(pTHXx_ XSINIT_t xsinit, int argc, char **argv, char **env) break; case 1: STATUS_ALL_FAILURE; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 2: /* my_exit() was called */ while (PL_scopestack_ix > oldscope) @@ -1662,6 +1663,9 @@ S_Internals_V(pTHX_ CV *cv) # ifdef NO_TAINT_SUPPORT " NO_TAINT_SUPPORT" # endif +# ifdef PERL_BOOL_AS_CHAR + " PERL_BOOL_AS_CHAR" +# endif # ifdef PERL_DISABLE_PMC " PERL_DISABLE_PMC" # endif @@ -1856,9 +1860,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) break; case 't': -#if SILENT_NO_TAINT_SUPPORT +#if defined(SILENT_NO_TAINT_SUPPORT) /* silently ignore */ -#elif NO_TAINT_SUPPORT +#elif defined(NO_TAINT_SUPPORT) Perl_croak_nocontext("This perl was compiled without taint support. " "Cowardly refusing to run with -t or -T flags"); #else @@ -1871,9 +1875,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) s++; goto reswitch; case 'T': -#if SILENT_NO_TAINT_SUPPORT +#if defined(SILENT_NO_TAINT_SUPPORT) /* silently ignore */ -#elif NO_TAINT_SUPPORT +#elif defined(NO_TAINT_SUPPORT) Perl_croak_nocontext("This perl was compiled without taint support. " "Cowardly refusing to run with -t or -T flags"); #else @@ -1886,7 +1890,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) case 'E': PL_minus_E = TRUE; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 'e': forbid_setid('e', FALSE); if (!PL_e_script) { @@ -1967,7 +1971,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) if (strEQ(s, "help")) usage(); s--; - /* FALL THROUGH */ + /* FALLTHROUGH */ default: Perl_croak(aTHX_ "Unrecognized switch: -%s (-h will show valid options)",s); } @@ -1988,9 +1992,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) while (isSPACE(*s)) s++; if (*s == '-' && *(s+1) == 'T') { -#if SILENT_NO_TAINT_SUPPORT +#if defined(SILENT_NO_TAINT_SUPPORT) /* silently ignore */ -#elif NO_TAINT_SUPPORT +#elif defined(NO_TAINT_SUPPORT) Perl_croak_nocontext("This perl was compiled without taint support. " "Cowardly refusing to run with -t or -T flags"); #else @@ -2027,9 +2031,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) } } if (*d == 't') { -#if SILENT_NO_TAINT_SUPPORT +#if defined(SILENT_NO_TAINT_SUPPORT) /* silently ignore */ -#elif NO_TAINT_SUPPORT +#elif defined(NO_TAINT_SUPPORT) Perl_croak_nocontext("This perl was compiled without taint support. " "Cowardly refusing to run with -t or -T flags"); #else @@ -2068,9 +2072,10 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) it should be reported immediately as a build failure. */ (void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav, Perl_newSVpvf(aTHX_ - "BEGIN { do {local $!; -f q%c%"SVf"/buildcustomize.pl%c} and do q%c%"SVf"/buildcustomize.pl%c || die $@ }", - 0, *inc0, 0, - 0, *inc0, 0)); + "BEGIN { my $f = q%c%s%"SVf"/buildcustomize.pl%c; " + "do {local $!; -f $f }" + " and do $f || die $@ || qq '$f: $!' }", + 0, (TAINTING_get ? "./" : ""), SVfARG(*inc0), 0)); } # else /* SITELIB_EXP is a function call on Win32. */ @@ -2083,8 +2088,8 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) (void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav, Perl_newSVpvf(aTHX_ "BEGIN { do {local $!; -f q%c%s/sitecustomize.pl%c} && do q%c%s/sitecustomize.pl%c }", - 0, sitelib, 0, - 0, sitelib, 0)); + 0, SVfARG(sitelib), 0, + 0, SVfARG(sitelib), 0)); assert (SvREFCNT(sitelib_sv) == 1); SvREFCNT_dec(sitelib_sv); } @@ -2246,32 +2251,6 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) } } -#ifdef PERL_MAD - { - const char *s; - if (!TAINTING_get && - (s = PerlEnv_getenv("PERL_XMLDUMP"))) { - PL_madskills = 1; - PL_minus_c = 1; - if (!s || !s[0]) - PL_xmlfp = PerlIO_stdout(); - else { - PL_xmlfp = PerlIO_open(s, "w"); - if (!PL_xmlfp) - Perl_croak(aTHX_ "Can't open %s", s); - } - 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, lex_start_flags); SvREFCNT_dec(linestr_sv); @@ -2314,8 +2293,8 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) #ifdef MYMALLOC { const char *s; - if ((s=PerlEnv_getenv("PERL_DEBUG_MSTATS")) && atoi(s) >= 2) - dump_mstats("after compilation:"); + if ((s=PerlEnv_getenv("PERL_DEBUG_MSTATS")) && grok_atou(s, NULL) >= 2) + dump_mstats("after compilation:"); } #endif @@ -2336,7 +2315,6 @@ Tells a Perl interpreter to run. See L. int perl_run(pTHXx) { - dVAR; I32 oldscope; int ret = 0; dJMPENV; @@ -2359,7 +2337,7 @@ perl_run(pTHXx) case 0: /* normal completion */ redo_body: run_body(oldscope); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 2: /* my_exit() */ while (PL_scopestack_ix > oldscope) LEAVE; @@ -2394,18 +2372,11 @@ perl_run(pTHXx) STATIC void S_run_body(pTHX_ I32 oldscope) { - dVAR; DEBUG_r(PerlIO_printf(Perl_debug_log, "%s $` $& $' support (0x%x).\n", PL_sawampersand ? "Enabling" : "Omitting", (unsigned int)(PL_sawampersand))); if (!PL_restartop) { -#ifdef PERL_MAD - if (PL_xmlfp) { - xmldump_all(); - exit(0); /* less likely to core dump than my_exit(0) */ - } -#endif #ifdef DEBUGGING if (DEBUG_x_TEST || DEBUG_B_TEST) dump_all_perl(!DEBUG_B_TEST); @@ -2600,7 +2571,6 @@ Perl_call_argv(pTHX_ const char *sub_name, I32 flags, char **argv) /* See G_* flags in cop.h */ /* null terminated arg list */ { - dVAR; dSP; PERL_ARGS_ASSERT_CALL_ARGV; @@ -2765,7 +2735,7 @@ Perl_call_sv(pTHX_ SV *sv, VOL I32 flags) break; case 1: STATUS_ALL_FAILURE; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 2: /* my_exit() was called */ SET_CURSTASH(PL_defstash); @@ -2874,7 +2844,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags) break; case 1: STATUS_ALL_FAILURE; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 2: /* my_exit() was called */ SET_CURSTASH(PL_defstash); @@ -2914,7 +2884,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags) /* =for apidoc p||eval_pv -Tells Perl to C the given string and return an SV* result. +Tells Perl to C the given string in scalar context and return an SV* result. =cut */ @@ -2922,7 +2892,6 @@ Tells Perl to C the given string and return an SV* result. SV* Perl_eval_pv(pTHX_ const char *p, I32 croak_on_error) { - dVAR; SV* sv = newSVpv(p, 0); PERL_ARGS_ASSERT_EVAL_PV; @@ -2963,7 +2932,6 @@ implemented that way; consider using load_module instead. void Perl_require_pv(pTHX_ const char *pv) { - dVAR; dSP; SV* sv; @@ -3061,6 +3029,7 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp) " q quiet - currently only suppresses the 'EXECUTING' message\n" " M trace smart match resolution\n" " B dump suBroutine definitions, including special Blocks like BEGIN\n", + " L trace some locale setting information--for Perl core development\n", NULL }; int i = 0; @@ -3069,7 +3038,7 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp) if (isALPHA(**s)) { /* if adding extra options, remember to update DEBUG_MASK */ - static const char debopts[] = "psltocPmfrxuUHXDSTRJvCAqMB"; + static const char debopts[] = "psltocPmfrxuUHXDSTRJvCAqMBL"; for (; isWORDCHAR(**s); (*s)++) { const char * const d = strchr(debopts,**s); @@ -3081,7 +3050,10 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp) } } else if (isDIGIT(**s)) { - i = atoi(*s); + const char* e; + i = grok_atou(*s, &e); + if (e) + *s = e; for (; isWORDCHAR(**s); (*s)++) ; } else if (givehelp) { @@ -3307,7 +3279,7 @@ Perl_moreswitches(pTHX_ const char *s) return s; case 'M': forbid_setid('M', FALSE); /* XXX ? */ - /* FALL THROUGH */ + /* FALLTHROUGH */ case 'm': forbid_setid('m', FALSE); /* XXX ? */ if (*++s) { @@ -3375,9 +3347,9 @@ Perl_moreswitches(pTHX_ const char *s) return s; case 't': case 'T': -#if SILENT_NO_TAINT_SUPPORT +#if defined(SILENT_NO_TAINT_SUPPORT) /* silently ignore */ -#elif NO_TAINT_SUPPORT +#elif defined(NO_TAINT_SUPPORT) Perl_croak_nocontext("This perl was compiled without taint support. " "Cowardly refusing to run with -t or -T flags"); #else @@ -3488,7 +3460,7 @@ S_minus_v(pTHX) "\nThis is perl " STRINGIFY(PERL_REVISION) ", version " STRINGIFY(PERL_VERSION) ", subversion " STRINGIFY(PERL_SUBVERSION) - " (%"SVf") built for " ARCHNAME, level + " (%"SVf") built for " ARCHNAME, SVfARG(level) ); SvREFCNT_dec_NN(level); } @@ -3564,7 +3536,6 @@ Internet, point your browser at http://www.perl.org/, the Perl Home Page.\n\n"); void Perl_my_unexec(pTHX) { - PERL_UNUSED_CONTEXT; #ifdef UNEXEC SV * prog = newSVpv(BIN_EXP, 0); SV * file = newSVpv(PL_origfilename, 0); @@ -3578,10 +3549,11 @@ Perl_my_unexec(pTHX) /* unexec prints msg to stderr in case of failure */ PerlProc_exit(status); #else + PERL_UNUSED_CONTEXT; # ifdef VMS lib$signal(SS$_DEBUG); /* ssdef.h #included from vmsish.h */ # elif defined(WIN32) || defined(__CYGWIN__) - Perl_croak(aTHX_ "dump is not supported"); + Perl_croak_nocontext("dump is not supported"); # else ABORT(); /* for use with undump */ # endif @@ -3592,7 +3564,6 @@ Perl_my_unexec(pTHX) STATIC void S_init_interp(pTHX) { - dVAR; #ifdef MULTIPLICITY # define PERLVAR(prefix,var,type) # define PERLVARA(prefix,var,n,type) @@ -3625,7 +3596,6 @@ S_init_interp(pTHX) STATIC void S_init_main_stash(pTHX) { - dVAR; GV *gv; PL_curstash = PL_defstash = (HV *)SvREFCNT_inc_simple_NN(newHV()); @@ -3677,8 +3647,8 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript) { int fdscript = -1; PerlIO *rsfp = NULL; - dVAR; Stat_t tmpstatbuf; + int fd; PERL_ARGS_ASSERT_OPEN_SCRIPT; @@ -3691,9 +3661,9 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript) if (strnEQ(scriptname, "/dev/fd/", 8) && isDIGIT(scriptname[8]) ) { const char *s = scriptname + 8; - fdscript = atoi(s); - while (isDIGIT(*s)) - s++; + const char* e; + fdscript = grok_atou(s, &e); + s = e; if (*s) { /* PSz 18 Feb 04 * Tell apart "normal" usage of fdscript, e.g. @@ -3751,7 +3721,9 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript) const char * const err = "Failed to create a fake bit bucket"; if (strEQ(scriptname, BIT_BUCKET)) { #ifdef HAS_MKSTEMP /* Hopefully mkstemp() is safe here. */ + int old_umask = umask(0600); int tmpfd = mkstemp(tmpname); + umask(old_umask); if (tmpfd > -1) { scriptname = tmpname; close(tmpfd); @@ -3784,13 +3756,20 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript) Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n", CopFILE(PL_curcop), Strerror(errno)); } + fd = PerlIO_fileno(rsfp); #if defined(HAS_FCNTL) && defined(F_SETFD) - /* ensure close-on-exec */ - fcntl(PerlIO_fileno(rsfp), F_SETFD, 1); + if (fd >= 0) { + /* ensure close-on-exec */ + if (fcntl(fd, F_SETFD, 1) < 0) { + Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n", + CopFILE(PL_curcop), Strerror(errno)); + } + } #endif - if (PerlLIO_fstat(PerlIO_fileno(rsfp), &tmpstatbuf) >= 0 - && S_ISDIR(tmpstatbuf.st_mode)) + if (fd < 0 || + (PerlLIO_fstat(fd, &tmpstatbuf) >= 0 + && S_ISDIR(tmpstatbuf.st_mode))) Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n", CopFILE(PL_curcop), Strerror(EISDIR)); @@ -3821,12 +3800,18 @@ S_validate_suid(pTHX_ PerlIO *rsfp) if (my_euid != my_uid || my_egid != my_gid) { /* (suidperl doesn't exist, in fact) */ dVAR; - - PerlLIO_fstat(PerlIO_fileno(rsfp),&PL_statbuf); /* may be either wrapped or real suid */ - if ((my_euid != my_uid && my_euid == PL_statbuf.st_uid && PL_statbuf.st_mode & S_ISUID) - || - (my_egid != my_gid && my_egid == PL_statbuf.st_gid && PL_statbuf.st_mode & S_ISGID) - ) + int fd = PerlIO_fileno(rsfp); + if (fd < 0) { + Perl_croak(aTHX_ "Illegal suidscript"); + } else { + if (PerlLIO_fstat(fd, &PL_statbuf) < 0) { /* may be either wrapped or real suid */ + Perl_croak(aTHX_ "Illegal suidscript"); + } + } + if ((my_euid != my_uid && my_euid == PL_statbuf.st_uid && PL_statbuf.st_mode & S_ISUID) + || + (my_egid != my_gid && my_egid == PL_statbuf.st_gid && PL_statbuf.st_mode & S_ISGID) + ) if (!PL_do_undump) Perl_croak(aTHX_ "YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!\n\ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n"); @@ -3838,7 +3823,6 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n"); STATIC void S_find_beginning(pTHX_ SV* linestr_sv, PerlIO *rsfp) { - dVAR; const char *s; const char *s2; @@ -3870,13 +3854,14 @@ S_init_ids(pTHX) { /* no need to do anything here any more if we don't * do tainting. */ -#if !NO_TAINT_SUPPORT - dVAR; +#ifndef NO_TAINT_SUPPORT const Uid_t my_uid = PerlProc_getuid(); const Uid_t my_euid = PerlProc_geteuid(); const Gid_t my_gid = PerlProc_getgid(); const Gid_t my_egid = PerlProc_getegid(); + PERL_UNUSED_CONTEXT; + /* Should not happen: */ CHECK_MALLOC_TAINT(my_uid && (my_euid != my_uid || my_egid != my_gid)); TAINTING_set( TAINTING_get | (my_uid && (my_euid != my_uid || my_egid != my_gid)) ); @@ -3924,7 +3909,7 @@ Perl_doing_taint(int argc, char *argv[], char *envp[]) * if -T are the first chars together; otherwise one gets * "Too late" message. */ if ( argc > 1 && argv[1][0] == '-' - && (argv[1][1] == 't' || argv[1][1] == 'T') ) + && isALPHA_FOLD_EQ(argv[1][1], 't')) return 1; return 0; } @@ -3936,10 +3921,10 @@ Perl_doing_taint(int argc, char *argv[], char *envp[]) STATIC void S_forbid_setid(pTHX_ const char flag, const bool suidscript) /* g */ { - dVAR; char string[3] = "-x"; const char *message = "program input from stdin"; + PERL_UNUSED_CONTEXT; if (flag) { string[1] = flag; message = string; @@ -3976,7 +3961,6 @@ Perl_init_dbargs(pTHX) void Perl_init_debugger(pTHX) { - dVAR; HV * const ostash = PL_curstash; PL_curstash = (HV *)SvREFCNT_inc_simple(PL_debstash); @@ -4015,7 +3999,6 @@ Perl_init_debugger(pTHX) void Perl_init_stacks(pTHX) { - dVAR; /* start with 128-item stack and 8K cxstack */ PL_curstackinfo = new_stackinfo(REASONABLE(128), REASONABLE(8192/sizeof(PERL_CONTEXT) - 1)); @@ -4055,7 +4038,6 @@ Perl_init_stacks(pTHX) STATIC void S_nuke_stacks(pTHX) { - dVAR; while (PL_curstackinfo->si_next) PL_curstackinfo = PL_curstackinfo->si_next; while (PL_curstackinfo) { @@ -4111,7 +4093,6 @@ Perl_populate_isa(pTHX_ const char *name, STRLEN len, ...) STATIC void S_init_predump_symbols(pTHX) { - dVAR; GV *tmpgv; IO *io; @@ -4172,8 +4153,6 @@ S_init_predump_symbols(pTHX) void Perl_init_argv_symbols(pTHX_ int argc, char **argv) { - dVAR; - PERL_ARGS_ASSERT_INIT_ARGV_SYMBOLS; argc--,argv++; /* skip name of script */ @@ -4220,7 +4199,9 @@ Perl_init_argv_symbols(pTHX_ int argc, char **argv) STATIC void S_init_postdump_symbols(pTHX_ int argc, char **argv, char **env) { +#ifdef USE_ITHREADS dVAR; +#endif GV* tmpgv; PERL_ARGS_ASSERT_INIT_POSTDUMP_SYMBOLS; @@ -4297,7 +4278,6 @@ S_init_postdump_symbols(pTHX_ int argc, char **argv, char **env) STATIC void S_init_perllib(pTHX) { - dVAR; #ifndef VMS const char *perl5lib = NULL; #endif @@ -4503,7 +4483,6 @@ S_init_perllib(pTHX) STATIC SV * S_incpush_if_exists(pTHX_ AV *const av, SV *dir, SV *const stem) { - dVAR; Stat_t tmpstatbuf; PERL_ARGS_ASSERT_INCPUSH_IF_EXISTS; @@ -4658,7 +4637,6 @@ S_mayberelocate(pTHX_ const char *const dir, STRLEN len, U32 flags) STATIC void S_incpush(pTHX_ const char *const dir, STRLEN len, U32 flags) { - dVAR; #ifndef PERL_IS_MINIPERL const U8 using_sub_dirs = (U8)flags & (INCPUSH_ADD_VERSIONED_SUB_DIRS @@ -4740,7 +4718,7 @@ S_incpush(pTHX_ const char *const dir, STRLEN len, U32 flags) #ifdef PERL_IS_MINIPERL const Size_t extra = 0; #else - Size_t extra = av_len(av) + 1; + Size_t extra = av_tindex(av) + 1; #endif av_unshift(inc, extra + push_basedir); if (push_basedir) @@ -4817,7 +4795,6 @@ S_incpush_use_sep(pTHX_ const char *p, STRLEN len, U32 flags) void Perl_call_list(pTHX_ I32 oldscope, AV *paramList) { - dVAR; SV *atsv; volatile const line_t oldline = PL_curcop ? CopLINE(PL_curcop) : 0; CV *cv; @@ -4827,7 +4804,7 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList) PERL_ARGS_ASSERT_CALL_LIST; - while (av_len(paramList) >= 0) { + while (av_tindex(paramList) >= 0) { cv = MUTABLE_CV(av_shift(paramList)); if (PL_savebegin) { if (paramList == PL_beginav) { @@ -4843,21 +4820,12 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList) Perl_av_create_and_push(aTHX_ &PL_unitcheckav_save, MUTABLE_SV(cv)); } } else { - if (!PL_madskills) - SAVEFREESV(cv); + SAVEFREESV(cv); } JMPENV_PUSH(ret); switch (ret) { case 0: -#ifdef PERL_MAD - if (PL_madskills) - PL_madskills |= 16384; -#endif CALL_LIST_BODY(cv); -#ifdef PERL_MAD - if (PL_madskills) - PL_madskills &= ~16384; -#endif atsv = ERRSV; (void)SvPV_const(atsv, len); if (len) { @@ -4880,7 +4848,7 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList) break; case 1: STATUS_ALL_FAILURE; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 2: /* my_exit() was called */ while (PL_scopestack_ix > oldscope) @@ -4909,7 +4877,6 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList) void Perl_my_exit(pTHX_ U32 status) { - dVAR; if (PL_exit_flags & PERL_EXIT_ABORT) { abort(); } @@ -4935,7 +4902,6 @@ Perl_my_exit(pTHX_ U32 status) void Perl_my_failure_exit(pTHX) { - dVAR; #ifdef VMS /* We have been called to fall on our sword. The desired exit code * should be already set in STATUS_UNIX, but could be shifted over @@ -5029,8 +4995,6 @@ Perl_my_failure_exit(pTHX) STATIC void S_my_exit_jump(pTHX) { - dVAR; - if (PL_e_script) { SvREFCNT_dec(PL_e_script); PL_e_script = NULL; @@ -5046,7 +5010,6 @@ S_my_exit_jump(pTHX) static I32 read_e_script(pTHX_ int idx, SV *buf_sv, int maxlen) { - dVAR; const char * const p = SvPVX_const(PL_e_script); const char *nl = strchr(p, '\n');