ary[key] = val;
if (SvSMAGICAL(av)) {
if (val != &PL_sv_undef) {
- MAGIC* mg = SvMAGIC(av);
+ const MAGIC* const mg = SvMAGIC(av);
sv_magic(val, (SV*)av, toLOWER(mg->mg_type), 0, key);
}
mg_set((SV*)av);
{
register I32 key;
+/* XXX Should av_clear really be NN? */
#ifdef DEBUGGING
if (SvREFCNT(av) == 0 && ckWARN_d(WARN_DEBUGGING)) {
Perl_warner(aTHX_ packWARN(WARN_DEBUGGING), "Attempt to clear deleted array");
}
if (fill <= AvMAX(av)) {
I32 key = AvFILLp(av);
- SV** ary = AvARRAY(av);
+ SV** const ary = AvARRAY(av);
if (AvREAL(av)) {
while (key > fill) {
SV *sv;
if (!av)
- return Nullsv;
+ return NULL;
if (SvREADONLY(av))
Perl_croak(aTHX_ PL_no_modify);
if (adjust_index) {
key += AvFILL(av) + 1;
if (key < 0)
- return Nullsv;
+ return NULL;
}
}
svp = av_fetch(av, key, TRUE);
sv_unmagic(sv, PERL_MAGIC_tiedelem); /* No longer an element */
return sv;
}
- return Nullsv;
+ return NULL;
}
}
}
if (key < 0) {
key += AvFILL(av) + 1;
if (key < 0)
- return Nullsv;
+ return NULL;
}
if (key > AvFILLp(av))
- return Nullsv;
+ return NULL;
else {
if (!AvREAL(av) && AvREIFY(av))
av_reify(av);
}
if (flags & G_DISCARD) {
SvREFCNT_dec(sv);
- sv = Nullsv;
+ sv = NULL;
}
else if (AvREAL(av))
sv = sv_2mortal(sv);
if (SvRMAGICAL(av)) {
const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if (tied_magic || mg_find((SV*)av, PERL_MAGIC_regdata)) {
- SV *sv = sv_newmortal();
+ SV * const sv = sv_newmortal();
MAGIC *mg;
/* Handle negative array indices 20020222 MJD */
if (key < 0) {
const U8 *send;
I32 matches = 0;
STRLEN len;
- const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
const short * const tbl = (short*)cPVOP->op_pv;
if (!tbl)
if (tbl[*s++] >= 0)
matches++;
}
- else
+ else {
+ const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
while (s < send) {
STRLEN ulen;
const UV c = utf8n_to_uvchr(s, send - s, &ulen, 0);
matches++;
s += ulen;
}
+ }
return matches;
}
U8 *dstart;
I32 isutf8;
I32 matches = 0;
- const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
- const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
- const I32 del = PL_op->op_private & OPpTRANS_DELETE;
STRLEN len, rlen = 0;
const short * const tbl = (short*)cPVOP->op_pv;
SvCUR_set(sv, d - dstart);
}
else { /* isutf8 */
+ const I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT;
+ const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
+ const I32 del = PL_op->op_private & OPpTRANS_DELETE;
+
if (grows)
Newx(d, len*2+1, U8);
else
const U8 * const e = s + len;
while (t < e) {
const U8 ch = *t++;
- if ((hibit = !NATIVE_IS_INVARIANT(ch)))
+ hibit = !NATIVE_IS_INVARIANT(ch);
+ if (hibit) {
+ s = bytes_to_utf8(s, &len);
break;
+ }
}
- if (hibit)
- s = bytes_to_utf8(s, &len);
}
send = s + len;
start = s;
const U8 * const e = s + len;
while (t < e) {
const U8 ch = *t++;
- if ((hibit = !NATIVE_IS_INVARIANT(ch)))
+ hibit = !NATIVE_IS_INVARIANT(ch);
+ if (hibit) {
+ start = s = bytes_to_utf8(s, &len);
break;
+ }
}
- if (hibit)
- start = s = bytes_to_utf8(s, &len);
}
send = s + len;
const U8 * const e = s + len;
while (t < e) {
const U8 ch = *t++;
- if ((hibit = !NATIVE_IS_INVARIANT(ch)))
+ hibit = !NATIVE_IS_INVARIANT(ch);
+ if (hibit) {
+ s = bytes_to_utf8(s, &len);
break;
+ }
}
- if (hibit)
- s = bytes_to_utf8(s, &len);
}
send = s + len;
start = s;
#define NEWSV(x,len) newSV(len)
#ifdef PERL_MALLOC_WRAP
-#define MEM_WRAP_CHECK(n,t) \
- (void)((sizeof(t)>1?(n):1)>((MEM_SIZE)~0)/sizeof(t)?(Perl_croak_nocontext(PL_memory_wrap),0):0)
+#define MEM_WRAP_CHECK(n,t) MEM_WRAP_CHECK_1(n,t,PL_memory_wrap)
#define MEM_WRAP_CHECK_1(n,t,a) \
(void)((sizeof(t)>1?(n):1)>((MEM_SIZE)~0)/sizeof(t)?(Perl_croak_nocontext(a),0):0)
-#define MEM_WRAP_CHECK_2(n,t,a,b) \
- (void)((sizeof(t)>1?(n):1)>((MEM_SIZE)~0)/sizeof(t)?(Perl_croak_nocontext(a,b),0):0)
#define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t),
#define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > (MEM_SIZE)~0 - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (Perl_croak_nocontext(PL_memory_wrap),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1)))
return hek ? &HeVAL(hek) : NULL;
}
+/* XXX This looks like an ideal candidate to inline */
SV**
Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val,
register U32 hash, int flags)
=cut
*/
+/* XXX This looks like an ideal candidate to inline */
HE *
Perl_hv_store_ent(pTHX_ HV *hv, SV *keysv, SV *val, U32 hash)
{
=cut
*/
+/* XXX This looks like an ideal candidate to inline */
bool
Perl_hv_exists_ent(pTHX_ HV *hv, SV *keysv, U32 hash)
{
=cut
*/
+/* XXX This looks like an ideal candidate to inline */
SV *
Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash)
{
getrx:
if (i >= 0) {
- int oldtainted = PL_tainted;
+ const int oldtainted = PL_tainted;
TAINT_NOT;
sv_setpvn(sv, s, i);
PL_tainted = oldtainted;
Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
{
dVAR;
- const char *s;
- const char *ptr;
STRLEN len, klen;
-
- s = SvPV_const(sv,len);
- ptr = MgPV_const(mg,klen);
+ const char *s = SvPV_const(sv,len);
+ const char * const ptr = MgPV_const(mg,klen);
my_setenv(ptr, s);
#ifdef DYNAMIC_ENV_FETCH
/* We just undefd an environment var. Is a replacement */
/* waiting in the wings? */
if (!len) {
- SV **valp;
- if ((valp = hv_fetch(GvHVn(PL_envgv), ptr, klen, FALSE)))
+ SV ** const valp = hv_fetch(GvHVn(PL_envgv), ptr, klen, FALSE);
+ if (valp)
s = SvPV_const(*valp, len);
}
#endif
if (!mg) {
if (!SvOK(sv))
return 0;
- sv_magic(lsv, (SV*)0, PERL_MAGIC_regex_global, Nullch, 0);
+ sv_magic(lsv, NULL, PERL_MAGIC_regex_global, NULL, 0);
mg = mg_find(lsv, PERL_MAGIC_regex_global);
}
else if (!SvOK(sv)) {
if (flags & 1)
PL_savestack_ix -= 5; /* Unprotect save in progress. */
- /* cxstack_ix-- Not needed, die already unwound it. */
#if !defined(PERL_IMPLICIT_CONTEXT)
if (flags & 64)
SvREFCNT_dec(PL_sig_sv);
CV *cv;
HV *stash;
GV *gv;
- SV *ret;
+ SV *ret = &PL_sv_undef;
- ret = &PL_sv_undef;
if (SvPOK(TOPs) && SvCUR(TOPs) >= 7) {
const char * const s = SvPVX_const(TOPs);
if (strnEQ(s, "CORE::", 6)) {
#define AMGf_unary 8
#define tryAMAGICbinW_var(meth_enum,assign,set) STMT_START { \
- if (PL_amagic_generation) { \
- SV* tmpsv; \
- SV* const right= *(sp); SV* const left= *(sp-1);\
- if ((SvAMAGIC(left)||SvAMAGIC(right))&&\
- (tmpsv=amagic_call(left, \
+ if (PL_amagic_generation) { \
+ SV* const left = *(sp-1); \
+ SV* const right = *(sp); \
+ if ((SvAMAGIC(left)||SvAMAGIC(right))) {\
+ SV * const tmpsv = amagic_call(left, \
right, \
meth_enum, \
- (assign)? AMGf_assign: 0))) {\
- SPAGAIN; \
- (void)POPs; set(tmpsv); RETURN; } \
- } \
+ (assign)? AMGf_assign: 0); \
+ if (tmpsv) { \
+ SPAGAIN; \
+ (void)POPs; set(tmpsv); RETURN; } \
+ } \
+ } \
} STMT_END
#define tryAMAGICbinW(meth,assign,set) \
if (!SvOK(sv))
return 0;
if (SvROK(sv)) {
- SV* tmpsv;
- if (SvAMAGIC(sv) && (tmpsv=AMG_CALLun(sv,bool_)) &&
- (!SvROK(tmpsv) || (SvRV(tmpsv) != SvRV(sv))))
- return (bool)SvTRUE(tmpsv);
- return SvRV(sv) != 0;
+ if (SvAMAGIC(sv)) {
+ SV * const tmpsv = AMG_CALLun(sv,bool_);
+ if (tmpsv && (!SvROK(tmpsv) || (SvRV(tmpsv) != SvRV(sv))))
+ return (bool)SvTRUE(tmpsv);
+ }
+ return SvRV(sv) != 0;
}
if (SvPOKp(sv)) {
register XPV* const Xpvtmp = (XPV*)SvANY(sv);
Perl_sv_catpvn_flags(pTHX_ register SV *dsv, register const char *sstr, register STRLEN slen, I32 flags)
{
STRLEN dlen;
- const char *dstr = SvPV_force_flags(dsv, dlen, flags);
+ const char * const dstr = SvPV_force_flags(dsv, dlen, flags);
SvGROW(dsv, dlen + slen + 1);
if (sstr == dstr)
{
/* Look for PL_op starting from o. cop is the last COP we've seen. */
- if (!o || o == PL_op) return cop;
+ if (!o || o == PL_op)
+ return cop;
if (o->op_flags & OPf_KIDS) {
OP *kid;
- for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling)
- {
+ for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling) {
COP *new_cop;
/* If the OP_NEXTSTATE has been optimised away we can still use it
/* Keep searching, and return when we've found something. */
new_cop = closest_cop(cop, kid);
- if (new_cop) return new_cop;
+ if (new_cop)
+ return new_cop;
}
}
return PerlProc_signal(signo, handler);
}
-static
-Signal_t
+static Signal_t
sig_trap(int signo)
{
dVAR;