summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c101
1 files changed, 48 insertions, 53 deletions
diff --git a/dump.c b/dump.c
index e74c8c4217..2a45e756f3 100644
--- a/dump.c
+++ b/dump.c
@@ -103,8 +103,6 @@ void
dump_op(op)
register OP *op;
{
- SV *tmpsv;
-
dump("{\n");
if (op->op_seq)
PerlIO_printf(Perl_debug_log, "%-4d", op->op_seq);
@@ -130,58 +128,57 @@ register OP *op;
dump("ADDR = 0x%lx => 0x%lx\n",op, op->op_next);
#endif
if (op->op_flags) {
- *buf = '\0';
+ SV *tmpsv = newSVpv("", 0);
switch (op->op_flags & OPf_WANT) {
case OPf_WANT_VOID:
- (void)strcat(buf,"VOID,");
+ sv_catpv(tmpsv, ",VOID");
break;
case OPf_WANT_SCALAR:
- (void)strcat(buf,"SCALAR,");
+ sv_catpv(tmpsv, ",SCALAR");
break;
case OPf_WANT_LIST:
- (void)strcat(buf,"LIST,");
+ sv_catpv(tmpsv, ",LIST");
break;
default:
- (void)strcat(buf,"UNKNOWN,");
+ sv_catpv(tmpsv, ",UNKNOWN");
break;
}
if (op->op_flags & OPf_KIDS)
- (void)strcat(buf,"KIDS,");
+ sv_catpv(tmpsv, ",KIDS");
if (op->op_flags & OPf_PARENS)
- (void)strcat(buf,"PARENS,");
+ sv_catpv(tmpsv, ",PARENS");
if (op->op_flags & OPf_STACKED)
- (void)strcat(buf,"STACKED,");
+ sv_catpv(tmpsv, ",STACKED");
if (op->op_flags & OPf_REF)
- (void)strcat(buf,"REF,");
+ sv_catpv(tmpsv, ",REF");
if (op->op_flags & OPf_MOD)
- (void)strcat(buf,"MOD,");
+ sv_catpv(tmpsv, ",MOD");
if (op->op_flags & OPf_SPECIAL)
- (void)strcat(buf,"SPECIAL,");
- if (*buf)
- buf[strlen(buf)-1] = '\0';
- dump("FLAGS = (%s)\n",buf);
+ sv_catpv(tmpsv, ",SPECIAL");
+ dump("FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
+ SvREFCNT_dec(tmpsv);
}
if (op->op_private) {
- *buf = '\0';
+ SV *tmpsv = newSVpv("", 0);
if (op->op_type == OP_AASSIGN) {
if (op->op_private & OPpASSIGN_COMMON)
- (void)strcat(buf,"COMMON,");
+ sv_catpv(tmpsv, ",COMMON");
}
else if (op->op_type == OP_SASSIGN) {
if (op->op_private & OPpASSIGN_BACKWARDS)
- (void)strcat(buf,"BACKWARDS,");
+ sv_catpv(tmpsv, ",BACKWARDS");
}
else if (op->op_type == OP_TRANS) {
if (op->op_private & OPpTRANS_SQUASH)
- (void)strcat(buf,"SQUASH,");
+ sv_catpv(tmpsv, ",SQUASH");
if (op->op_private & OPpTRANS_DELETE)
- (void)strcat(buf,"DELETE,");
+ sv_catpv(tmpsv, ",DELETE");
if (op->op_private & OPpTRANS_COMPLEMENT)
- (void)strcat(buf,"COMPLEMENT,");
+ sv_catpv(tmpsv, ",COMPLEMENT");
}
else if (op->op_type == OP_REPEAT) {
if (op->op_private & OPpREPEAT_DOLIST)
- (void)strcat(buf,"DOLIST,");
+ sv_catpv(tmpsv, ",DOLIST");
}
else if (op->op_type == OP_ENTERSUB ||
op->op_type == OP_RV2SV ||
@@ -193,56 +190,55 @@ register OP *op;
{
if (op->op_type == OP_ENTERSUB) {
if (op->op_private & OPpENTERSUB_AMPER)
- (void)strcat(buf,"AMPER,");
+ sv_catpv(tmpsv, ",AMPER");
if (op->op_private & OPpENTERSUB_DB)
- (void)strcat(buf,"DB,");
+ sv_catpv(tmpsv, ",DB");
}
switch (op->op_private & OPpDEREF) {
case OPpDEREF_SV:
- (void)strcat(buf, "SV,");
+ sv_catpv(tmpsv, ",SV");
break;
case OPpDEREF_AV:
- (void)strcat(buf, "AV,");
+ sv_catpv(tmpsv, ",AV");
break;
case OPpDEREF_HV:
- (void)strcat(buf, "HV,");
+ sv_catpv(tmpsv, ",HV");
break;
}
if (op->op_type == OP_AELEM || op->op_type == OP_HELEM) {
if (op->op_private & OPpLVAL_DEFER)
- (void)strcat(buf,"LVAL_DEFER,");
+ sv_catpv(tmpsv, ",LVAL_DEFER");
}
else {
if (op->op_private & HINT_STRICT_REFS)
- (void)strcat(buf,"STRICT_REFS,");
+ sv_catpv(tmpsv, ",STRICT_REFS");
}
}
else if (op->op_type == OP_CONST) {
if (op->op_private & OPpCONST_BARE)
- (void)strcat(buf,"BARE,");
+ sv_catpv(tmpsv, ",BARE");
}
else if (op->op_type == OP_FLIP) {
if (op->op_private & OPpFLIP_LINENUM)
- (void)strcat(buf,"LINENUM,");
+ sv_catpv(tmpsv, ",LINENUM");
}
else if (op->op_type == OP_FLOP) {
if (op->op_private & OPpFLIP_LINENUM)
- (void)strcat(buf,"LINENUM,");
+ sv_catpv(tmpsv, ",LINENUM");
}
if (op->op_flags & OPf_MOD && op->op_private & OPpLVAL_INTRO)
- (void)strcat(buf,"INTRO,");
- if (*buf) {
- buf[strlen(buf)-1] = '\0';
- dump("PRIVATE = (%s)\n",buf);
- }
+ sv_catpv(tmpsv, ",INTRO");
+ if (SvCUR(tmpsv))
+ dump("PRIVATE = (%s)\n", SvPVX(tmpsv) + 1);
+ SvREFCNT_dec(tmpsv);
}
switch (op->op_type) {
case OP_GVSV:
case OP_GV:
if (cGVOP->op_gv) {
+ SV *tmpsv = NEWSV(0,0);
ENTER;
- tmpsv = NEWSV(0,0);
SAVEFREESV(tmpsv);
gv_fullname3(tmpsv, cGVOP->op_gv, Nullch);
dump("GV = %s\n", SvPV(tmpsv, na));
@@ -367,30 +363,29 @@ register PMOP *pm;
dump("PMf_SHORT = %s\n",SvPEEK(pm->op_pmshort));
}
if (pm->op_pmflags) {
- *buf = '\0';
+ SV *tmpsv = newSVpv("", 0);
if (pm->op_pmflags & PMf_USED)
- (void)strcat(buf,"USED,");
+ sv_catpv(tmpsv, ",USED");
if (pm->op_pmflags & PMf_ONCE)
- (void)strcat(buf,"ONCE,");
+ sv_catpv(tmpsv, ",ONCE");
if (pm->op_pmflags & PMf_SCANFIRST)
- (void)strcat(buf,"SCANFIRST,");
+ sv_catpv(tmpsv, ",SCANFIRST");
if (pm->op_pmflags & PMf_ALL)
- (void)strcat(buf,"ALL,");
+ sv_catpv(tmpsv, ",ALL");
if (pm->op_pmflags & PMf_SKIPWHITE)
- (void)strcat(buf,"SKIPWHITE,");
+ sv_catpv(tmpsv, ",SKIPWHITE");
if (pm->op_pmflags & PMf_CONST)
- (void)strcat(buf,"CONST,");
+ sv_catpv(tmpsv, ",CONST");
if (pm->op_pmflags & PMf_KEEP)
- (void)strcat(buf,"KEEP,");
+ sv_catpv(tmpsv, ",KEEP");
if (pm->op_pmflags & PMf_GLOBAL)
- (void)strcat(buf,"GLOBAL,");
+ sv_catpv(tmpsv, ",GLOBAL");
if (pm->op_pmflags & PMf_RUNTIME)
- (void)strcat(buf,"RUNTIME,");
+ sv_catpv(tmpsv, ",RUNTIME");
if (pm->op_pmflags & PMf_EVAL)
- (void)strcat(buf,"EVAL,");
- if (*buf)
- buf[strlen(buf)-1] = '\0';
- dump("PMFLAGS = (%s)\n",buf);
+ sv_catpv(tmpsv, ",EVAL");
+ dump("PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
+ SvREFCNT_dec(tmpsv);
}
dumplvl--;