# endif
if ((long) PL_mmap_page_size < 0) {
if (errno) {
- SV *error = ERRSV;
+ SV * const error = ERRSV;
(void) SvUPGRADE(error, SVt_PV);
Perl_croak(aTHX_ "panic: sysconf: %s", SvPV_nolen_const(error));
}
*/
I32 riter = 0;
const I32 max = HvMAX(PL_strtab);
- HE **array = HvARRAY(PL_strtab);
+ HE ** const array = HvARRAY(PL_strtab);
HE *hent = array[0];
for (;;) {
if (hent && ckWARN_d(WARN_INTERNAL)) {
- HE *next = HeNEXT(hent);
+ HE * const next = HeNEXT(hent);
Perl_warner(aTHX_ packWARN(WARN_INTERNAL),
- "Unbalanced string table refcount: (%d) for \"%s\"",
- HeVAL(hent) - Nullsv, HeKEY(hent));
+ "Unbalanced string table refcount: (%ld) for \"%s\"",
+ (long)(HeVAL(hent) - Nullsv), HeKEY(hent));
Safefree(hent);
hent = next;
}
PL_preambleav = newAV();
s++;
{
- char *start = s;
- SV *sv = newSVpv("use assertions::activate", 24);
+ char * const start = s;
+ SV * const sv = newSVpv("use assertions::activate", 24);
while(isALNUM(*s) || *s == ':') ++s;
if (s != start) {
sv_catpvn(sv, "::", 2);
mg = mg_find(sv, PERL_MAGIC_qr);
}
if (mg) {
- regexp *re = (regexp *)mg->mg_obj;
+ regexp * const re = (regexp *)mg->mg_obj;
ReREFCNT_dec(PM_GETRE(pm));
PM_SETRE(pm, ReREFCNT_inc(re));
}
}
cx->sb_s = rx->endp[0] + orig;
{ /* Update the pos() information. */
- SV *sv = cx->sb_targ;
+ SV * const sv = cx->sb_targ;
MAGIC *mg;
I32 i;
if (SvTYPE(sv) < SVt_PVMG)
void
Perl_rxres_free(pTHX_ void **rsp)
{
- UV *p = (UV*)*rsp;
+ UV * const p = (UV*)*rsp;
if (p) {
#ifdef PERL_POISON
}
else {
dTOPss;
- SV *targ = PAD_SV(PL_op->op_targ);
+ SV * const targ = PAD_SV(PL_op->op_targ);
int flip = 0;
if (PL_op->op_private & OPpFLIP_LINENUM) {
flip = SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv));
}
else {
- GV *gv = gv_fetchpv(".", TRUE, SVt_PV);
- if (gv && GvSV(gv)) flip = SvIV(sv) == SvIV(GvSV(gv));
+ GV * const gv = gv_fetchpv(".", TRUE, SVt_PV);
+ if (gv && GvSV(gv))
+ flip = SvIV(sv) == SvIV(GvSV(gv));
}
} else {
flip = SvTRUE(sv);
}
}
else {
- SV *final = sv_mortalcopy(right);
+ SV * const final = sv_mortalcopy(right);
STRLEN len;
const char *tmps = SvPV_const(final, len);
PL_curcop = cx->blk_oldcop;
if (optype == OP_REQUIRE) {
- const char* msg = SvPVx_nolen_const(ERRSV);
+ const char* const msg = SvPVx_nolen_const(ERRSV);
SV * const nsv = cx->blk_eval.old_namesv;
(void)hv_store(GvHVn(PL_incgv), SvPVX_const(nsv), SvCUR(nsv),
&PL_sv_undef, 0);
STRLEN len;
const char *tryname = Nullch;
SV *namesv = Nullsv;
- SV** svp;
const I32 gimme = GIMME_V;
PerlIO *tryrsfp = 0;
int filter_has_file = 0;
if (!(name && len > 0 && *name))
DIE(aTHX_ "Null filename used");
TAINT_PROPER("require");
- if (PL_op->op_type == OP_REQUIRE &&
- (svp = hv_fetch(GvHVn(PL_incgv), name, len, 0))) {
- if (*svp != &PL_sv_undef)
- RETPUSHYES;
- else
- DIE(aTHX_ "Compilation failed in require");
+ if (PL_op->op_type == OP_REQUIRE) {
+ SV ** const svp = hv_fetch(GvHVn(PL_incgv), name, len, 0);
+ if ( svp ) {
+ if (*svp != &PL_sv_undef)
+ RETPUSHYES;
+ else
+ DIE(aTHX_ "Compilation failed in require");
+ }
}
/* prepare to compile file */
}
#endif
if (!tryrsfp) {
- AV *ar = GvAVn(PL_incgv);
+ AV * const ar = GvAVn(PL_incgv);
I32 i;
#ifdef VMS
char *unixname;
if (PL_op->op_type == OP_REQUIRE) {
const char *msgstr = name;
if(errno == EMFILE) {
- SV *msg = sv_2mortal(newSVpv(msgstr,0));
+ SV * const msg = sv_2mortal(newSVpv(msgstr,0));
sv_catpv(msg, ": ");
sv_catpv(msg, Strerror(errno));
msgstr = SvPV_nolen_const(msg);
} else {
if (namesv) { /* did we lookup @INC? */
- SV *msg = sv_2mortal(newSVpv(msgstr,0));
- SV *dirmsgsv = NEWSV(0, 0);
- AV *ar = GvAVn(PL_incgv);
+ SV * const msg = sv_2mortal(newSVpv(msgstr,0));
+ SV * const dirmsgsv = NEWSV(0, 0);
+ AV * const ar = GvAVn(PL_incgv);
I32 i;
sv_catpvn(msg, " in @INC", 8);
if (instr(SvPVX_const(msg), ".h "))
/* Assume success here to prevent recursive requirement. */
len = strlen(name);
/* Check whether a hook in @INC has already filled %INC */
- if (!hook_sv || !(svp = hv_fetch(GvHVn(PL_incgv), name, len, 0))) {
- (void)hv_store(GvHVn(PL_incgv), name, len,
- (hook_sv ? SvREFCNT_inc(hook_sv)
- : newSVpv(CopFILE(&PL_compiling), 0)),
- 0 );
+ if (!hook_sv) {
+ (void)hv_store(GvHVn(PL_incgv), name, len, newSVpv(CopFILE(&PL_compiling),0),0);
+ } else {
+ SV** const svp = hv_fetch(GvHVn(PL_incgv), name, len, 0);
+ if (!svp)
+ (void)hv_store(GvHVn(PL_incgv), name, len, SvREFCNT_inc(hook_sv), 0 );
}
ENTER;
/* add a new entry to a pointer-mapping table */
void
-Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldv, void *newv)
+Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldsv, void *newsv)
{
PTR_TBL_ENT_t *tblent, **otblent;
/* XXX this may be pessimal on platforms where pointers aren't good
* hash values e.g. if they grow faster in the most significant
* bits */
- const UV hash = PTR_TABLE_HASH(oldv);
+ const UV hash = PTR_TABLE_HASH(oldsv);
bool empty = 1;
assert(tbl);
otblent = &tbl->tbl_ary[hash & tbl->tbl_max];
for (tblent = *otblent; tblent; empty=0, tblent = tblent->next) {
- if (tblent->oldval == oldv) {
- tblent->newval = newv;
+ if (tblent->oldval == oldsv) {
+ tblent->newval = newsv;
return;
}
}
new_body_inline(tblent, (void**)&PL_pte_arenaroot, (void**)&PL_pte_root,
sizeof(struct ptr_tbl_ent));
- tblent->oldval = oldv;
- tblent->newval = newv;
+ tblent->oldval = oldsv;
+ tblent->newval = newsv;
tblent->next = *otblent;
*otblent = tblent;
tbl->tbl_items++;