summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-09-27 12:05:36 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-27 12:05:36 +0000
commit98c991d172ba25ca965007e58ce8e7c0f9910f56 (patch)
treecb7bcf4d689f9da964c3e16e51e49a8c8315f2b8 /dump.c
parent97c10e7733209f2a73e1d4b214196ecbe19275b2 (diff)
downloadperl-98c991d172ba25ca965007e58ce8e7c0f9910f56.tar.gz
Dump Unicode hash keys also as Unicode,
not just as a byte string. p4raw-id: //depot/perl@12246
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/dump.c b/dump.c
index 6d7c007e44..3d24ccb8d3 100644
--- a/dump.c
+++ b/dump.c
@@ -1129,7 +1129,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
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));
if (SvUTF8(sv)) /* the 8? \x{....} */
- PerlIO_printf(file, " %s", sv_uni_display(d, sv, 8 * sv_len_utf8(sv)));
+ PerlIO_printf(file, " [UTF8 %s]", sv_uni_display(d, sv, 8 * sv_len_utf8(sv)));
PerlIO_printf(file, "\n");
Perl_dump_indent(aTHX_ level, file, " CUR = %"IVdf"\n", (IV)SvCUR(sv));
Perl_dump_indent(aTHX_ level, file, " LEN = %"IVdf"\n", (IV)SvLEN(sv));
@@ -1251,14 +1251,18 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
hv_iterinit(hv);
while ((he = hv_iternext(hv)) && count--) {
- SV *elt;
- char *key;
- I32 len;
+ SV *elt, *keysv;
+ char *keypv;
+ STRLEN len;
U32 hash = HeHASH(he);
- key = hv_iterkey(he, &len);
+ keysv = hv_iterkeysv(he);
+ keypv = SvPV(keysv, len);
elt = hv_iterval(hv, he);
- Perl_dump_indent(aTHX_ level+1, file, "Elt %s HASH = 0x%"UVxf"\n", pv_display(d, key, len, 0, pvlim), (UV)hash);
+ Perl_dump_indent(aTHX_ level+1, file, "Elt %s ", pv_display(d, keypv, len, 0, pvlim));
+ if (SvUTF8(keysv))
+ PerlIO_printf(file, "[UTF8 %s] ", sv_uni_display(d, keysv, 8 * sv_len_utf8(keysv)));
+ PerlIO_printf(file, "HASH = 0x%"UVxf"\n", (UV)hash);
do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim);
}
hv_iterinit(hv); /* Return to status quo */