From: Alexandr Ciornii Date: Thu, 8 May 2008 16:35:42 +0000 (+0300) Subject: Data::Dumper patch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=02c1405339c35fee7f7e6b0f030a5873bb634802;p=p5sagit%2Fp5-mst-13.2.git Data::Dumper patch Message-ID: <13810622109.20080508163542@gmail.com> for support on perls < 5.10.0 p4raw-id: //depot/perl@33790 --- diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index 434e3d9..af5c2e2 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -3,6 +3,7 @@ #include "perl.h" #include "XSUB.h" #ifdef USE_PPPORT_H +# define NEED_my_snprintf # include "ppport.h" #endif @@ -191,7 +192,13 @@ esc_q_utf8(pTHX_ SV* sv, register const char *src, register STRLEN slen) #endif *r++ = (char)k; else { +#if PERL_VERSION < 10 + sprintf(r, "\\x{%"UVxf"}", k); + r += strlen(r); + #my_sprintf is not supported by ppport.h +#else r = r + my_sprintf(r, "\\x{%"UVxf"}", k); +#endif } } *r++ = '"'; @@ -552,7 +559,12 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, ilen = inamelen; sv_setiv(ixsv, ix); +#if PERL_VERSION < 10 + (void) sprintf(iname+ilen, "%"IVdf, (IV)ix); + ilen = strlen(iname); +#else ilen = ilen + my_sprintf(iname+ilen, "%"IVdf, (IV)ix); +#endif iname[ilen++] = ']'; iname[ilen] = '\0'; if (indent >= 3) { sv_catsv(retval, totpad);