summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/dump.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2006-03-28 19:23:16 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2006-03-28 19:23:16 +0000
commit17d22ff90d7678f627704149ed0e537b4380531e (patch)
treee8df9aa3a393dcb98f06f2f1f5bb9ac88cd1b988 /gnu/usr.bin/perl/dump.c
parent21e49c3d2e0bc23209dd78235f7cc3dc8802a2df (diff)
merge in perl 5.8.8
Diffstat (limited to 'gnu/usr.bin/perl/dump.c')
-rw-r--r--gnu/usr.bin/perl/dump.c167
1 files changed, 93 insertions, 74 deletions
diff --git a/gnu/usr.bin/perl/dump.c b/gnu/usr.bin/perl/dump.c
index 79aa2c19c6a..81dc1239b3d 100644
--- a/gnu/usr.bin/perl/dump.c
+++ b/gnu/usr.bin/perl/dump.c
@@ -1,7 +1,7 @@
/* dump.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, 2004, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
@@ -54,23 +54,23 @@ void
Perl_dump_packsubs(pTHX_ HV *stash)
{
I32 i;
- HE *entry;
if (!HvARRAY(stash))
return;
for (i = 0; i <= (I32) HvMAX(stash); i++) {
+ const HE *entry;
for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
- GV *gv = (GV*)HeVAL(entry);
- HV *hv;
+ const GV *gv = (GV*)HeVAL(entry);
+ const HV *hv;
if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv))
continue;
if (GvCVu(gv))
- dump_sub(gv);
+ dump_sub((GV *)gv);
if (GvFORM(gv))
- dump_form(gv);
+ dump_form((GV *)gv);
if (HeKEY(entry)[HeKLEN(entry)-1] == ':'
&& (hv = GvHV(gv)) && hv != PL_defstash)
- dump_packsubs(hv); /* nested package */
+ dump_packsubs((HV *) hv); /* nested package */
}
}
}
@@ -78,10 +78,10 @@ Perl_dump_packsubs(pTHX_ HV *stash)
void
Perl_dump_sub(pTHX_ GV *gv)
{
- SV *sv = sv_newmortal();
+ SV * const sv = sv_newmortal();
gv_fullname3(sv, gv, Nullch);
- Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX_const(sv));
if (CvXSUB(GvCV(gv)))
Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%"UVxf" %d)\n",
PTR2UV(CvXSUB(GvCV(gv))),
@@ -95,10 +95,10 @@ Perl_dump_sub(pTHX_ GV *gv)
void
Perl_dump_form(pTHX_ GV *gv)
{
- SV *sv = sv_newmortal();
+ SV * const sv = sv_newmortal();
gv_fullname3(sv, gv, Nullch);
- Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nFORMAT %s = ", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nFORMAT %s = ", SvPVX_const(sv));
if (CvROOT(GvFORM(gv)))
op_dump(CvROOT(GvFORM(gv)));
else
@@ -114,13 +114,13 @@ Perl_dump_eval(pTHX)
char *
Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
{
- int truncated = 0;
- int nul_terminated = len > cur && pv[cur] == '\0';
+ const bool nul_terminated = len > cur && pv[cur] == '\0';
+ bool truncated = 0;
sv_setpvn(dsv, "\"", 1);
for (; cur--; pv++) {
if (pvlim && SvCUR(dsv) >= pvlim) {
- truncated++;
+ truncated = 1;
break;
}
switch (*pv) {
@@ -151,8 +151,7 @@ Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
char *
Perl_sv_peek(pTHX_ SV *sv)
{
- SV *t = sv_newmortal();
- STRLEN n_a;
+ SV * const t = sv_newmortal();
int unref = 0;
sv_setpvn(t, "", 0);
@@ -190,7 +189,7 @@ Perl_sv_peek(pTHX_ SV *sv)
!(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
SVp_POK|SVp_NOK)) &&
SvCUR(sv) == 1 &&
- SvPVX(sv) && *SvPVX(sv) == '1' &&
+ SvPVX_const(sv) && *SvPVX_const(sv) == '1' &&
SvNVX(sv) == 1.0)
goto finish;
}
@@ -227,7 +226,7 @@ Perl_sv_peek(pTHX_ SV *sv)
if (SvROK(sv)) {
sv_catpv(t, "\\");
if (SvCUR(t) + unref > 10) {
- SvCUR(t) = unref + 3;
+ SvCUR_set(t, unref + 3);
*SvEND(t) = '\0';
sv_catpv(t, "...");
goto finish;
@@ -294,14 +293,14 @@ Perl_sv_peek(pTHX_ SV *sv)
}
if (SvPOKp(sv)) {
- if (!SvPVX(sv))
+ if (!SvPVX_const(sv))
sv_catpv(t, "(null)");
else {
SV *tmp = newSVpvn("", 0);
sv_catpv(t, "(");
if (SvOOK(sv))
- Perl_sv_catpvf(aTHX_ t, "[%s]", pv_display(tmp, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
- Perl_sv_catpvf(aTHX_ t, "%s)", pv_display(tmp, SvPVX(sv), SvCUR(sv), SvLEN(sv), 127));
+ Perl_sv_catpvf(aTHX_ t, "[%s]", pv_display(tmp, (char *)SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
+ Perl_sv_catpvf(aTHX_ t, "%s)", pv_display(tmp, (char *)SvPVX_const(sv), SvCUR(sv), SvLEN(sv), 127));
if (SvUTF8(sv))
Perl_sv_catpvf(aTHX_ t, " [UTF8 \"%s\"]",
sv_uni_display(tmp, sv, 8 * sv_len_utf8(sv),
@@ -328,7 +327,7 @@ Perl_sv_peek(pTHX_ SV *sv)
while (unref--)
sv_catpv(t, ")");
}
- return SvPV(t, n_a);
+ return SvPV_nolen(t);
}
void
@@ -384,7 +383,7 @@ Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP *pm)
sv_catpv(tmpsv, ",RETAINT");
if (pm->op_pmflags & PMf_EVAL)
sv_catpv(tmpsv, ",EVAL");
- Perl_dump_indent(aTHX_ level, file, "PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
+ Perl_dump_indent(aTHX_ level, file, "PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");
SvREFCNT_dec(tmpsv);
}
@@ -468,7 +467,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
sv_catpv(tmpsv, ",MOD");
if (o->op_flags & OPf_SPECIAL)
sv_catpv(tmpsv, ",SPECIAL");
- Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
+ Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");
SvREFCNT_dec(tmpsv);
}
if (o->op_private) {
@@ -638,7 +637,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
if (o->op_flags & OPf_MOD && o->op_private & OPpLVAL_INTRO)
sv_catpv(tmpsv, ",INTRO");
if (SvCUR(tmpsv))
- Perl_dump_indent(aTHX_ level, file, "PRIVATE = (%s)\n", SvPVX(tmpsv) + 1);
+ Perl_dump_indent(aTHX_ level, file, "PRIVATE = (%s)\n", SvPVX_const(tmpsv) + 1);
SvREFCNT_dec(tmpsv);
}
@@ -652,11 +651,11 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
if ( ! PL_op->op_flags & OPf_SPECIAL) { /* not lexical */
if (cSVOPo->op_sv) {
SV *tmpsv = NEWSV(0,0);
- STRLEN n_a;
ENTER;
SAVEFREESV(tmpsv);
gv_fullname3(tmpsv, (GV*)cSVOPo->op_sv, Nullch);
- Perl_dump_indent(aTHX_ level, file, "GV = %s\n", SvPV(tmpsv, n_a));
+ Perl_dump_indent(aTHX_ level, file, "GV = %s\n",
+ SvPV_nolen_const(tmpsv));
LEAVE;
}
else
@@ -758,10 +757,10 @@ Perl_gv_dump(pTHX_ GV *gv)
sv = sv_newmortal();
PerlIO_printf(Perl_debug_log, "{\n");
gv_fullname3(sv, gv, Nullch);
- Perl_dump_indent(aTHX_ 1, Perl_debug_log, "GV_NAME = %s", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 1, Perl_debug_log, "GV_NAME = %s", SvPVX_const(sv));
if (gv != GvEGV(gv)) {
gv_efullname3(sv, GvEGV(gv), Nullch);
- Perl_dump_indent(aTHX_ 1, Perl_debug_log, "-> %s", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 1, Perl_debug_log, "-> %s", SvPVX_const(sv));
}
PerlIO_putc(Perl_debug_log, '\n');
Perl_dump_indent(aTHX_ 0, Perl_debug_log, "}\n");
@@ -772,7 +771,7 @@ Perl_gv_dump(pTHX_ GV *gv)
* (with the PERL_MAGIC_ prefixed stripped)
*/
-static struct { char type; char *name; } magic_names[] = {
+static const struct { const char type; const char *name; } magic_names[] = {
{ PERL_MAGIC_sv, "sv(\\0)" },
{ PERL_MAGIC_arylen, "arylen(#)" },
{ PERL_MAGIC_glob, "glob(*)" },
@@ -823,8 +822,8 @@ Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxne
Perl_dump_indent(aTHX_ level, file,
" MAGIC = 0x%"UVxf"\n", PTR2UV(mg));
if (mg->mg_virtual) {
- MGVTBL *v = mg->mg_virtual;
- char *s = 0;
+ const MGVTBL * const v = mg->mg_virtual;
+ const char *s = 0;
if (v == &PL_vtbl_sv) s = "sv";
else if (v == &PL_vtbl_env) s = "env";
else if (v == &PL_vtbl_envelem) s = "envelem";
@@ -866,8 +865,8 @@ Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxne
{
int n;
- char *name = 0;
- for (n=0; magic_names[n].name; n++) {
+ const char *name = 0;
+ for (n = 0; magic_names[n].name; n++) {
if (mg->mg_type == magic_names[n].type) {
name = magic_names[n].name;
break;
@@ -943,9 +942,10 @@ Perl_magic_dump(pTHX_ MAGIC *mg)
void
Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv)
{
+ const char *hvname;
Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
- if (sv && HvNAME(sv))
- PerlIO_printf(file, "\t\"%s\"\n", HvNAME(sv));
+ if (sv && (hvname = HvNAME_get(sv)))
+ PerlIO_printf(file, "\t\"%s\"\n", hvname);
else
PerlIO_putc(file, '\n');
}
@@ -965,9 +965,10 @@ Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
{
Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && GvNAME(sv)) {
+ const char *hvname;
PerlIO_printf(file, "\t\"");
- if (GvSTASH(sv))
- PerlIO_printf(file, "%s\" :: \"", HvNAME(GvSTASH(sv)));
+ if (GvSTASH(sv) && (hvname = HvNAME_get(GvSTASH(sv))))
+ PerlIO_printf(file, "%s\" :: \"", hvname);
PerlIO_printf(file, "%s\"\n", GvNAME(sv));
}
else
@@ -978,7 +979,7 @@ void
Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
{
SV *d;
- char *s;
+ const char *s;
U32 flags;
U32 type;
@@ -1021,7 +1022,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
if (flags & SVp_IOK) sv_catpv(d, "pIOK,");
if (flags & SVp_NOK) sv_catpv(d, "pNOK,");
if (flags & SVp_POK) sv_catpv(d, "pPOK,");
- if (flags & SVp_SCREAM) sv_catpv(d, "SCREAM,");
+ if (flags & SVp_SCREAM && type != SVt_PVHV)
+ sv_catpv(d, "SCREAM,");
switch (type) {
case SVt_PVCV:
@@ -1043,6 +1045,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
if (HvLAZYDEL(sv)) sv_catpv(d, "LAZYDEL,");
if (HvHASKFLAGS(sv)) sv_catpv(d, "HASKFLAGS,");
if (HvREHASH(sv)) sv_catpv(d, "REHASH,");
+ if (flags & SVphv_CLONEABLE) sv_catpv(d, "CLONEABLE,");
break;
case SVt_PVGV:
if (GvINTRO(sv)) sv_catpv(d, "INTRO,");
@@ -1067,7 +1070,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
/* FALL THROUGH */
default:
if (SvEVALED(sv)) sv_catpv(d, "EVALED,");
- if (SvIsUV(sv)) sv_catpv(d, "IsUV,");
+ if (SvIsUV(sv) && !(flags & SVf_ROK)) sv_catpv(d, "IsUV,");
break;
case SVt_PVBM:
if (SvTAIL(sv)) sv_catpv(d, "TAIL,");
@@ -1078,13 +1081,16 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
sv_catpv(d, "TYPED,");
break;
}
- if ((SvPOK(sv) || SvPOKp(sv)) && SvUTF8(sv))
+ /* SVphv_SHAREKEYS is also 0x20000000 */
+ if ((type != SVt_PVHV) && SvUTF8(sv))
sv_catpv(d, "UTF8");
- if (*(SvEND(d) - 1) == ',')
- SvPVX(d)[--SvCUR(d)] = '\0';
+ if (*(SvEND(d) - 1) == ',') {
+ SvCUR_set(d, SvCUR(d) - 1);
+ SvPVX(d)[SvCUR(d)] = '\0';
+ }
sv_catpv(d, ")");
- s = SvPVX(d);
+ s = SvPVX_const(d);
Perl_dump_indent(aTHX_ level, file, "SV = ");
switch (type) {
@@ -1171,11 +1177,11 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
return;
}
if (type <= SVt_PVLV) {
- if (SvPVX(sv)) {
- Perl_dump_indent(aTHX_ level, file," PV = 0x%"UVxf" ", PTR2UV(SvPVX(sv)));
+ if (SvPVX_const(sv)) {
+ Perl_dump_indent(aTHX_ level, file," PV = 0x%"UVxf" ", PTR2UV(SvPVX_const(sv)));
if (SvOOK(sv))
- PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
- PerlIO_printf(file, "%s", pv_display(d, SvPVX(sv), SvCUR(sv), SvLEN(sv), pvlim));
+ PerlIO_printf(file, "( %s . ) ", pv_display(d, (char *)SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
+ PerlIO_printf(file, "%s", pv_display(d, (char *)SvPVX_const(sv), SvCUR(sv), SvLEN(sv), pvlim));
if (SvUTF8(sv)) /* the 8? \x{....} */
PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 8 * sv_len_utf8(sv), UNI_DISPLAY_QQ));
PerlIO_printf(file, "\n");
@@ -1213,11 +1219,12 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)AvMAX(sv));
Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", PTR2UV(AvARYLEN(sv)));
flags = AvFLAGS(sv);
- sv_setpv(d, "");
+ sv_setpvn(d, "", 0);
if (flags & AVf_REAL) sv_catpv(d, ",REAL");
if (flags & AVf_REIFY) sv_catpv(d, ",REIFY");
if (flags & AVf_REUSED) sv_catpv(d, ",REUSED");
- Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n", SvCUR(d) ? SvPVX(d) + 1 : "");
+ Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n",
+ SvCUR(d) ? SvPVX_const(d) + 1 : "");
if (nest < maxnest && av_len((AV*)sv) >= 0) {
int count;
for (count = 0; count <= av_len((AV*)sv) && count < maxnest; count++) {
@@ -1287,13 +1294,16 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvKEYS(sv));
Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)HvFILL(sv));
Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)HvMAX(sv));
- Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER(sv));
- Perl_dump_indent(aTHX_ level, file, " EITER = 0x%"UVxf"\n", PTR2UV(HvEITER(sv)));
+ Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER_get(sv));
+ Perl_dump_indent(aTHX_ level, file, " EITER = 0x%"UVxf"\n", PTR2UV(HvEITER_get(sv)));
if (HvPMROOT(sv))
Perl_dump_indent(aTHX_ level, file, " PMROOT = 0x%"UVxf"\n", PTR2UV(HvPMROOT(sv)));
- if (HvNAME(sv))
- Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", HvNAME(sv));
- if (nest < maxnest && !HvEITER(sv)) { /* Try to preserve iterator */
+ {
+ const char *hvname = HvNAME_get(sv);
+ if (hvname)
+ Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", hvname);
+ }
+ if (nest < maxnest && !HvEITER_get(sv)) { /* Try to preserve iterator */
HE *he;
HV *hv = (HV*)sv;
int count = maxnest - nest;
@@ -1302,14 +1312,14 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
while ((he = hv_iternext_flags(hv, HV_ITERNEXT_WANTPLACEHOLDERS))
&& count--) {
SV *elt, *keysv;
- char *keypv;
+ const char *keypv;
STRLEN len;
U32 hash = HeHASH(he);
keysv = hv_iterkeysv(he);
- keypv = SvPV(keysv, len);
+ keypv = SvPV_const(keysv, len);
elt = hv_iterval(hv, he);
- Perl_dump_indent(aTHX_ level+1, file, "Elt %s ", pv_display(d, keypv, len, 0, pvlim));
+ Perl_dump_indent(aTHX_ level+1, file, "Elt %s ", pv_display(d, (char *)keypv, len, 0, pvlim));
if (SvUTF8(keysv))
PerlIO_printf(file, "[UTF8 \"%s\"] ", sv_uni_display(d, keysv, 8 * sv_len_utf8(keysv), UNI_DISPLAY_QQ));
if (HeKREHASH(he))
@@ -1322,7 +1332,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
break;
case SVt_PVCV:
if (SvPOK(sv))
- Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%s\"\n", SvPV_nolen(sv));
+ Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%s\"\n", SvPV_nolen_const(sv));
/* FALL THROUGH */
case SVt_PVFM:
do_hv_dump(level, file, " COMP_STASH", CvSTASH(sv));
@@ -1349,7 +1359,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
do_dump_pad(level+1, file, CvPADLIST(sv), 0);
}
{
- CV *outside = CvOUTSIDE(sv);
+ const CV *outside = CvOUTSIDE(sv);
Perl_dump_indent(aTHX_ level, file, " OUTSIDE = 0x%"UVxf" (%s)\n",
PTR2UV(outside),
(!outside ? "null"
@@ -1455,10 +1465,6 @@ Perl_runops_debug(pTHX)
I32
Perl_debop(pTHX_ OP *o)
{
- AV *padlist, *comppad;
- CV *cv;
- SV *sv;
-
if (CopSTASH_eq(PL_curcop, PL_debstash) && !DEBUG_J_TEST_)
return 0;
@@ -1470,9 +1476,9 @@ Perl_debop(pTHX_ OP *o)
case OP_GVSV:
case OP_GV:
if (cGVOPo_gv) {
- sv = NEWSV(0,0);
+ SV *sv = NEWSV(0,0);
gv_fullname3(sv, cGVOPo_gv, Nullch);
- PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen(sv));
+ PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen_const(sv));
SvREFCNT_dec(sv);
}
else
@@ -1481,18 +1487,21 @@ Perl_debop(pTHX_ OP *o)
case OP_PADSV:
case OP_PADAV:
case OP_PADHV:
+ {
/* print the lexical's name */
- cv = deb_curcv(cxstack_ix);
+ CV *cv = deb_curcv(cxstack_ix);
+ SV *sv;
if (cv) {
- padlist = CvPADLIST(cv);
- comppad = (AV*)(*av_fetch(padlist, 0, FALSE));
+ AV * const padlist = CvPADLIST(cv);
+ AV * const comppad = (AV*)(*av_fetch(padlist, 0, FALSE));
sv = *av_fetch(comppad, o->op_targ, FALSE);
} else
sv = Nullsv;
if (sv)
- PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen(sv));
+ PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen_const(sv));
else
PerlIO_printf(Perl_debug_log, "[%"UVuf"]", (UV)o->op_targ);
+ }
break;
default:
break;
@@ -1504,7 +1513,7 @@ Perl_debop(pTHX_ OP *o)
STATIC CV*
S_deb_curcv(pTHX_ I32 ix)
{
- PERL_CONTEXT *cx = &cxstack[ix];
+ const PERL_CONTEXT *cx = &cxstack[ix];
if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT)
return cx->blk_sub.cv;
else if (CxTYPE(cx) == CXt_EVAL && !CxTRYBLOCK(cx))
@@ -1527,12 +1536,12 @@ Perl_watch(pTHX_ char **addr)
}
STATIC void
-S_debprof(pTHX_ OP *o)
+S_debprof(pTHX_ const OP *o)
{
if (CopSTASH_eq(PL_curcop, PL_debstash) && !DEBUG_J_TEST_)
return;
if (!PL_profiledata)
- Newz(000, PL_profiledata, MAXO, U32);
+ Newxz(PL_profiledata, MAXO, U32);
++PL_profiledata[o->op_type];
}
@@ -1549,3 +1558,13 @@ Perl_debprofdump(pTHX)
PL_op_name[i]);
}
}
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * ex: set ts=8 sts=4 sw=4 noet:
+ */