From: Tony Cook Date: Thu, 6 Sep 2001 12:35:49 +0000 (+1000) Subject: Extra NUL is Data::Dumper output - patch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f397e0261018d400b509a826d2f1e196ea810bcf;p=p5sagit%2Fp5-mst-13.2.git Extra NUL is Data::Dumper output - patch Message-ID: p4raw-id: //depot/perl@11916 --- diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index b9fb54b..8fc7ac3 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -137,7 +137,7 @@ esc_q_utf8(pTHX_ SV* sv, register char *src, register STRLEN slen) r[0] = r[j++] = '"'; else r[0] = r[j++] = '\''; - r[j++] = '\0'; + r[j] = '\0'; SvCUR_set(sv, SvCUR(sv) + j); return j; diff --git a/ext/Data/Dumper/t/dumper.t b/ext/Data/Dumper/t/dumper.t index 10add1c..bf07229 100755 --- a/ext/Data/Dumper/t/dumper.t +++ b/ext/Data/Dumper/t/dumper.t @@ -61,11 +61,11 @@ sub TEST { if (defined &Data::Dumper::Dumpxs) { print "### XS extension loaded, will run XS tests\n"; - $TMAX = 186; $XS = 1; + $TMAX = 192; $XS = 1; } else { print "### XS extensions not loaded, will NOT run XS tests\n"; - $TMAX = 93; $XS = 0; + $TMAX = 96; $XS = 0; } print "1..$TMAX\n"; @@ -808,3 +808,16 @@ TEST q(Data::Dumper->new([$b],['b'])->Purity(1)->Dump;); TEST q(Data::Dumper->new([$b],['b'])->Purity(1)->Dumpxs;) if $XS; } + +{ + $a = "\x{09c10}"; +############# 187 +## XS code was adding an extra \0 + $WANT = <<'EOT'; +#$a = "\x{9c10}"; +EOT + + TEST q(Data::Dumper->Dump([$a], ['a'])); + TEST q(Data::Dumper->Dumpxs([$a], ['a'])); + +}