struct IPerlProc* ipP)
{
PerlInterpreter *my_perl;
- /* New() needs interpreter, so call malloc() instead */
+ /* Newx() needs interpreter, so call malloc() instead */
my_perl = (PerlInterpreter*)(*ipM->pMalloc)(ipM, sizeof(PerlInterpreter));
S_init_tls_and_interp(my_perl);
Zero(my_perl, 1, PerlInterpreter);
{
PerlInterpreter *my_perl;
- /* New() needs interpreter, so call malloc() instead */
+ /* Newx() needs interpreter, so call malloc() instead */
my_perl = (PerlInterpreter*)PerlMem_malloc(sizeof(PerlInterpreter));
S_init_tls_and_interp(my_perl);
SvREFCNT(&PL_sv_placeholder) = (~(U32)0)/2;
}
- PL_sighandlerp = Perl_sighandler;
+ PL_sighandlerp = (Sighandler_t) Perl_sighandler;
PL_pidstatus = newHV();
}
Safefree(PL_reg_start_tmp);
PL_reg_start_tmp = (char**)NULL;
PL_reg_start_tmpl = 0;
- if (PL_reg_curpm)
- Safefree(PL_reg_curpm);
+ Safefree(PL_reg_curpm);
Safefree(PL_reg_poscache);
free_tied_hv_pool();
Safefree(PL_op_mask);
argc--,argv++;
}
if (s && *s) {
- char *p;
STRLEN len = strlen(s);
- p = savepvn(s, len);
+ const char * const p = savepvn(s, len);
incpush(p, TRUE, TRUE, FALSE, FALSE);
sv_catpvn(sv, "-I", 2);
sv_catpvn(sv, p, len);
# ifdef DEBUGGING
sv_catpv(opts_prog," DEBUGGING");
# endif
+# ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
+ sv_catpv(opts_prog," DEBUG_LEAKING_SCALARS_FORK_DUMP");
+# endif
+# ifdef FAKE_THREADS
+ sv_catpv(opts_prog," FAKE_THREADS");
+# endif
# ifdef MULTIPLICITY
sv_catpv(opts_prog," MULTIPLICITY");
# endif
+# ifdef MYMALLOC
+ sv_catpv(opts_prog," MYMALLOC");
+# endif
+# ifdef PERL_DONT_CREATE_GVSV
+ sv_catpv(opts_prog," PERL_DONT_CREATE_GVSV");
+# endif
+# ifdef PERL_GLOBAL_STRUCT
+ sv_catpv(opts_prog," PERL_GLOBAL_STRUCT");
+# endif
+# ifdef PERL_IMPLICIT_CONTEXT
+ sv_catpv(opts_prog," PERL_IMPLICIT_CONTEXT");
+# endif
+# ifdef PERL_IMPLICIT_SYS
+ sv_catpv(opts_prog," PERL_IMPLICIT_SYS");
+# endif
+# ifdef PERL_MALLOC_WRAP
+ sv_catpv(opts_prog," PERL_MALLOC_WRAP");
+# endif
+# ifdef PERL_NEED_APPCTX
+ sv_catpv(opts_prog," PERL_NEED_APPCTX");
+# endif
+# ifdef PERL_NEED_TIMESBASE
+ sv_catpv(opts_prog," PERL_NEED_TIMESBASE");
+# endif
+# ifdef PERL_OLD_COPY_ON_WRITE
+ sv_catpv(opts_prog," PERL_OLD_COPY_ON_WRITE");
+# endif
+# ifdef PL_OP_SLAB_ALLOC
+ sv_catpv(opts_prog," PL_OP_SLAB_ALLOC");
+# endif
+# ifdef THREADS_HAVE_PIDS
+ sv_catpv(opts_prog," THREADS_HAVE_PIDS");
+# endif
# ifdef USE_5005THREADS
sv_catpv(opts_prog," USE_5005THREADS");
# endif
-# ifdef USE_ITHREADS
- sv_catpv(opts_prog," USE_ITHREADS");
+# ifdef USE_64_BIT_ALL
+ sv_catpv(opts_prog," USE_64_BIT_ALL");
# endif
# ifdef USE_64_BIT_INT
sv_catpv(opts_prog," USE_64_BIT_INT");
# endif
-# ifdef USE_64_BIT_ALL
- sv_catpv(opts_prog," USE_64_BIT_ALL");
+# ifdef USE_ITHREADS
+ sv_catpv(opts_prog," USE_ITHREADS");
+# endif
+# ifdef USE_LARGE_FILES
+ sv_catpv(opts_prog," USE_LARGE_FILES");
# endif
# ifdef USE_LONG_DOUBLE
sv_catpv(opts_prog," USE_LONG_DOUBLE");
# endif
-# ifdef USE_LARGE_FILES
- sv_catpv(opts_prog," USE_LARGE_FILES");
+# ifdef USE_PERLIO
+ sv_catpv(opts_prog," USE_PERLIO");
# endif
-# ifdef USE_SOCKS
- sv_catpv(opts_prog," USE_SOCKS");
+# ifdef USE_REENTRANT_API
+ sv_catpv(opts_prog," USE_REENTRANT_API");
+# endif
+# ifdef USE_SFIO
+ sv_catpv(opts_prog," USE_SFIO");
# endif
# ifdef USE_SITECUSTOMIZE
sv_catpv(opts_prog," USE_SITECUSTOMIZE");
# endif
-# ifdef PERL_IMPLICIT_CONTEXT
- sv_catpv(opts_prog," PERL_IMPLICIT_CONTEXT");
-# endif
-# ifdef PERL_IMPLICIT_SYS
- sv_catpv(opts_prog," PERL_IMPLICIT_SYS");
+# ifdef USE_SOCKS
+ sv_catpv(opts_prog," USE_SOCKS");
# endif
while (SvCUR(opts_prog) > opts+76) {
# define SIGCHLD SIGCLD
#endif
Sighandler_t sigstate = rsignal_state(SIGCHLD);
- if (sigstate == SIG_IGN) {
+ if (sigstate == (Sighandler_t) SIG_IGN) {
if (ckWARN(WARN_SIGNAL))
Perl_warner(aTHX_ packWARN(WARN_SIGNAL),
"Can't ignore signal CHLD, forcing to default");
CvPADLIST(PL_compcv) = pad_new(0);
#ifdef USE_5005THREADS
CvOWNER(PL_compcv) = 0;
- New(666, CvMUTEXP(PL_compcv), 1, perl_mutex);
+ Newx(CvMUTEXP(PL_compcv), 1, perl_mutex);
MUTEX_INIT(CvMUTEXP(PL_compcv));
#endif /* USE_5005THREADS */
if (!PL_restartop) {
DEBUG_x(dump_all());
+#ifdef DEBUGGING
if (!DEBUG_q_TEST)
PERL_DEBUG(PerlIO_printf(Perl_debug_log, "\nEXECUTING...\n\n"));
+#endif
DEBUG_S(PerlIO_printf(Perl_debug_log, "main thread is 0x%"UVxf"\n",
PTR2UV(thr)));
HV*
Perl_get_hv(pTHX_ const char *name, I32 create)
{
- GV* gv = gv_fetchpv(name, create, SVt_PVHV);
+ GV* const gv = gv_fetchpv(name, create, SVt_PVHV);
if (create)
return GvHVn(gv);
if (gv)
dSP;
PUSHSTACKi(PERLSI_REQUIRE);
PUTBACK;
- sv = sv_newmortal();
- sv_setpv(sv, "require '");
- sv_catpv(sv, pv);
- sv_catpv(sv, "'");
- eval_sv(sv, G_DISCARD);
+ sv = Perl_newSVpvf(aTHX_ "require q%c%s%c", 0, pv, 0);
+ eval_sv(sv_2mortal(sv), G_DISCARD);
SPAGAIN;
POPSTACK;
}
usage(PL_origargv[0]);
my_exit(0);
case 'i':
- if (PL_inplace)
- Safefree(PL_inplace);
+ Safefree(PL_inplace);
#if defined(__CYGWIN__) /* do backup extension automagically */
if (*(s+1) == '\0') {
PL_inplace = savepv(".bak");
PL_stack_sp = PL_stack_base;
PL_stack_max = PL_stack_base + AvMAX(PL_curstack);
- New(50,PL_tmps_stack,REASONABLE(128),SV*);
+ Newx(PL_tmps_stack,REASONABLE(128),SV*);
PL_tmps_floor = -1;
PL_tmps_ix = -1;
PL_tmps_max = REASONABLE(128);
- New(54,PL_markstack,REASONABLE(32),I32);
+ Newx(PL_markstack,REASONABLE(32),I32);
PL_markstack_ptr = PL_markstack;
PL_markstack_max = PL_markstack + REASONABLE(32);
SET_MARK_OFFSET;
- New(54,PL_scopestack,REASONABLE(32),I32);
+ Newx(PL_scopestack,REASONABLE(32),I32);
PL_scopestack_ix = 0;
PL_scopestack_max = REASONABLE(32);
- New(54,PL_savestack,REASONABLE(128),ANY);
+ Newx(PL_savestack,REASONABLE(128),ANY);
PL_savestack_ix = 0;
PL_savestack_max = REASONABLE(128);
}
PL_statname = NEWSV(66,0); /* last filename we did stat on */
- if (PL_osname)
- Safefree(PL_osname);
+ Safefree(PL_osname);
PL_osname = savepv(OSNAME);
}
void
Perl_init_argv_symbols(pTHX_ register int argc, register char **argv)
{
- char *s;
argc--,argv++; /* skip name of script */
if (PL_doswitches) {
for (; argc > 0 && **argv == '-'; argc--,argv++) {
+ char *s;
if (!argv[0][1])
break;
if (argv[0][1] == '-' && !argv[0][2]) {
(void)gv_AVadd(PL_argvgv);
av_clear(GvAVn(PL_argvgv));
for (; argc > 0; argc--,argv++) {
- SV *sv = newSVpv(argv[0],0);
+ SV * const sv = newSVpv(argv[0],0);
av_push(GvAVn(PL_argvgv),sv);
if (!(PL_unicode & PERL_UNICODE_LOCALE_FLAG) || PL_utf8locale) {
if (PL_unicode & PERL_UNICODE_ARGV_FLAG)
* The intent is that /usr/local/bin/perl and .../../lib/perl5
* generates /usr/local/lib/perl5
*/
- char *libpath = SvPVX(libdir);
+ const char *libpath = SvPVX(libdir);
STRLEN libpath_len = SvCUR(libdir);
if (libpath_len >= 4 && memEQ (libpath, ".../", 4)) {
/* Game on! */
- SV *caret_X = get_sv("\030", 0);
+ SV * const caret_X = get_sv("\030", 0);
/* Going to use the SV just as a scratch buffer holding a C
string: */
SV *prefix_sv;
#endif
XPV *xpv;
- Newz(53, thr, 1, struct perl_thread);
+ Newxz(thr, 1, struct perl_thread);
PL_curcop = &PL_compiling;
thr->interp = PERL_GET_INTERP;
thr->cvcache = newHV();
thr->flags = THRf_R_JOINABLE;
MUTEX_INIT(&thr->mutex);
/* Handcraft thrsv similarly to mess_sv */
- New(53, PL_thrsv, 1, SV);
- Newz(53, xpv, 1, XPV);
+ Newx(PL_thrsv, 1, SV);
+ Newxz(xpv, 1, XPV);
SvFLAGS(PL_thrsv) = SVt_PV;
SvANY(PL_thrsv) = (void*)xpv;
SvREFCNT(PL_thrsv) = 1 << 30; /* practically infinite */