Change 17819 by [EMAIL PROTECTED] on 2002/08/30 13:42:02

        Subject: [PATCH] Tweaks to Bleadperl Version Object Support
        From: John Peacock <[EMAIL PROTECTED]>
        Date: Wed, 28 Aug 2002 22:13:48 -0400
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

.... //depot/perl/universal.c#56 edit
.... //depot/perl/util.c#360 edit

Differences ...

==== //depot/perl/universal.c#56 (text) ====
Index: perl/universal.c
--- perl/universal.c#55~17763~  Fri Aug 23 05:23:31 2002
+++ perl/universal.c    Fri Aug 30 06:42:02 2002
@@ -192,6 +192,7 @@
        sv_inc(sv);
        SvSETMAGIC(sv);
        /* Make it findable via fetchmethod */
+       newXS("version::()", XS_version_noop, file);
        newXS("version::new", XS_version_new, file);
        newXS("version::(\"\"", XS_version_stringify, file);
        newXS("version::stringify", XS_version_stringify, file);

==== //depot/perl/util.c#360 (text) ====
Index: perl/util.c
--- perl/util.c#359~17798~      Thu Aug 29 04:44:00 2002
+++ perl/util.c Fri Aug 30 06:42:02 2002
@@ -4155,27 +4155,34 @@
 char *
 Perl_scan_version(pTHX_ char *version, SV *rv)
 {
-    char *d;
+    char* d;
     int beta = 0;
-    SV * sv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
+    SV* sv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
     d = version;
     if (*d == 'v')
        d++;
     if (isDIGIT(*d)) {
-       while (isDIGIT(*d) || *d == '.')
+       while (isDIGIT(*d) || *d == '.' || *d == '\0')
            d++;
-       if ( *d == '_' ) {
+       if (*d == '_') {
            *d = '.';
-           if ( *(d+1) == '0' && *(d+2) != '0' ) { /* perl-style version */
+           if (*(d+1) == '0' && *(d+2) != '0') { /* perl-style version */
                *(d+1) = *(d+2);
                *(d+2) = '0';
+               if (ckWARN(WARN_PORTABLE))
+                   Perl_warner(aTHX_ packWARN(WARN_PORTABLE),
+                               "perl-style version not portable");
            }
            else {
                beta = -1;
            }
        }
+       while (isDIGIT(*d) || *d == '.' || *d == '\0')
+           d++;
+       if (*d == '_')
+           Perl_croak(aTHX_ "Invalid version format (multiple underscores)");
     }
-    version = scan_vstring(version,sv);        /* store the v-string in the object */
+    version = scan_vstring(version, sv); /* store the v-string in the object */
     SvIVX(sv) = beta;
     return version;
 }
@@ -4299,10 +4306,14 @@
        pv += retlen, len -= retlen)
     {
        digit = utf8_to_uvchr(pv,&retlen);
-       Perl_sv_catpvf(aTHX_ sv,".%03"UVf,digit);
+       Perl_sv_catpvf(aTHX_ sv,".%"UVf,digit);
+    }
+    if (SvIVX(vs) < 0) {
+       char* pv = SvPVX(sv); 
+       for (pv += SvCUR(sv); *pv != '.'; pv--)
+           ;
+       *pv = '_';
     }
-    if ( SvIVX(vs) < 0 )
-       sv_catpv(sv,"beta");
     return sv;
 }
 
End of Patch.

Reply via email to