diff options
author | John Peacock <jpeacock@rowman.com> | 2002-10-14 18:36:48 -0400 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-10-17 14:39:27 +0000 |
commit | 26ec6fc3972632211ff6621d98aed1b1df0d166d (patch) | |
tree | ce58c63bf94d46bb90b2ffbcf9123e7823194270 /util.c | |
parent | 46314c133ffe2db9038a340b36533579af4603b9 (diff) | |
download | perl-26ec6fc3972632211ff6621d98aed1b1df0d166d.tar.gz |
Re: versions too accurate
Message-ID: <3DAB7F40.1050200@rowman.com>
p4raw-id: //depot/perl@18027
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -4082,14 +4082,23 @@ SV * Perl_new_version(pTHX_ SV *ver) { SV *rv = NEWSV(92,5); - char *version = (char *)SvPV(ver,PL_na); - + char *version; + if ( SvNOK(ver) ) /* may get too much accuracy */ + { + char tbuf[64]; + sprintf(tbuf,"%.9"NVgf, SvNVX(ver)); + version = savepv(tbuf); + } #ifdef SvVOK - if ( SvVOK(ver) ) { /* already a v-string */ + else if ( SvVOK(ver) ) { /* already a v-string */ MAGIC* mg = mg_find(ver,PERL_MAGIC_vstring); version = savepvn( (const char*)mg->mg_ptr,mg->mg_len ); } #endif + else + { + version = (char *)SvPV(ver,PL_na); + } version = scan_version(version,rv); return rv; } |