S_sequence(pTHX_ register const OP *o)
{
dVAR;
- SV *op;
- const char *key;
- STRLEN len;
const OP *oldop = NULL;
- OP *l;
if (!o)
return;
Sequence = newHV();
for (; o; o = o->op_next) {
- op = newSVuv(PTR2UV(o));
- key = SvPV_const(op, len);
+ STRLEN len;
+ SV * const op = newSVuv(PTR2UV(o));
+ const char * const key = SvPV_const(op, len);
+
if (hv_exists(Sequence, key, len))
break;
case OP_COND_EXPR:
case OP_RANGE:
hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
- for (l = cLOGOPo->op_other; l && l->op_type == OP_NULL; l = l->op_next)
- ;
- sequence(l);
+ sequence_tail(cLOGOPo->op_other);
break;
case OP_ENTERLOOP:
case OP_ENTERITER:
hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
- for (l = cLOOPo->op_redoop; l && l->op_type == OP_NULL; l = l->op_next)
- ;
- sequence(l);
- for (l = cLOOPo->op_nextop; l && l->op_type == OP_NULL; l = l->op_next)
- ;
- sequence(l);
- for (l = cLOOPo->op_lastop; l && l->op_type == OP_NULL; l = l->op_next)
- ;
- sequence(l);
+ sequence_tail(cLOOPo->op_redoop);
+ sequence_tail(cLOOPo->op_nextop);
+ sequence_tail(cLOOPo->op_lastop);
break;
case OP_QR:
case OP_MATCH:
case OP_SUBST:
hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
- for (l = cPMOPo->op_pmreplstart; l && l->op_type == OP_NULL; l = l->op_next)
- ;
- sequence(l);
+ sequence_tail(cPMOPo->op_pmreplstart);
break;
case OP_HELEM:
}
}
+static void
+S_sequence_tail(pTHX_ const OP *o)
+{
+ while (o && (o->op_type == OP_NULL))
+ o = o->op_next;
+ sequence(o);
+}
+
STATIC UV
S_sequence_num(pTHX_ const OP *o)
{
if (GvASSUMECV(sv)) sv_catpv(d, "ASSUMECV,");
if (GvIN_PAD(sv)) sv_catpv(d, "IN_PAD,");
if (SvPAD_OUR(sv)) sv_catpv(d, "OUR,");
+ if (SvPAD_STATE(sv)) sv_catpv(d, "STATE,");
if (SvPAD_TYPED(sv)) sv_catpv(d, "TYPED,");
if (GvIMPORTED(sv)) {
sv_catpv(d, "IMPORT");
if (HvARRAY(sv) && HvKEYS(sv)) {
/* Show distribution of HEs in the ARRAY */
int freq[200];
-#define FREQ_MAX (sizeof freq / sizeof freq[0] - 1)
+#define FREQ_MAX ((int)(sizeof freq / sizeof freq[0] - 1))
int i;
int max = 0;
U32 pow2 = 2, keys = HvKEYS(sv);