summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-09-02 15:01:39 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-09-02 15:01:39 +0000
commitc76df65ea1362504976e117978fbad4e35fdbb7e (patch)
tree64f3c294b45eee3eb3786a2ccffb674092c070bc /util.c
parente75d1f1083177907de70add76a22bf9ee81d8f6c (diff)
downloadperl-c76df65ea1362504976e117978fbad4e35fdbb7e.tar.gz
Upgrade to version 0.42.
From: Subject: CPAN Upload: J/JP/JPEACOCK/version-0.42.tar.gz From: John Peacock <jpeacock@rowman.com> Date: Wed, 18 Aug 2004 08:26:35 -0400 Message-ID: <41234AFB.1020009@rowman.com> p4raw-id: //depot/perl@23257
Diffstat (limited to 'util.c')
-rw-r--r--util.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/util.c b/util.c
index cd28c197c4..396a40c6ef 100644
--- a/util.c
+++ b/util.c
@@ -3934,7 +3934,7 @@ Perl_scan_version(pTHX_ char *s, SV *rv, bool qv)
* floating point number, i.e. not quoted in any way
*/
if ( !qv && s > start+1 && saw_period == 1 ) {
- mult *= 100;
+ mult *= 100;
while ( s < end ) {
orev = rev;
rev += (*s - '0') * mult;
@@ -3983,7 +3983,7 @@ Perl_scan_version(pTHX_ char *s, SV *rv, bool qv)
*/
len = 2 - len;
while (len-- > 0)
- av_push((AV *)sv, newSViv(0));
+ av_push((AV *)sv, newSViv(0));
}
return s;
}
@@ -4117,10 +4117,11 @@ Perl_vnumify(pTHX_ SV *vs)
if ( len > 0 )
{
digit = SvIVX(*av_fetch((AV *)vs, len, 0));
-
- /* Don't display any additional trailing zeros */
if ( (int)PERL_ABS(digit) != 0 || len == 1 )
{
+ if ( digit < 0 ) /* alpha version */
+ Perl_sv_catpv(aTHX_ sv,"_");
+ /* Don't display additional trailing zeros */
Perl_sv_catpvf(aTHX_ sv,"%03d", (int)PERL_ABS(digit));
}
}
@@ -4191,12 +4192,13 @@ the original version contained 1 or more dots, respectively
SV *
Perl_vstringify(pTHX_ SV *vs)
{
- I32 len;
+ I32 len, digit;
if ( SvROK(vs) )
vs = SvRV(vs);
len = av_len((AV *)vs);
+ digit = SvIVX(*av_fetch((AV *)vs, len, 0));
- if ( len < 2 )
+ if ( len < 2 || ( len == 2 && digit < 0 ) )
return vnumify(vs);
else
return vnormal(vs);