Replace *printf "%d.%d.%d", PERL_REVISION, PERL_VERSION, PERL_SUBVERSION
authorNicholas Clark <nick@ccl4.org>
Mon, 16 Feb 2009 21:16:21 +0000 (21:16 +0000)
committerDavid Mitchell <davem@iabyn.com>
Tue, 14 Apr 2009 21:55:28 +0000 (22:55 +0100)
with PERL_VERSION_STRING, which can be determined at compile time, as a
constant string.

(cherry picked from commit e8e3635e321a3d3ac3b355d31c5d04e1a479615f)

patchlevel.h
perl.c

index ac9ddd7..d059946 100644 (file)
 #define PERL_VERSION   10              /* epoch */
 #define PERL_SUBVERSION        0               /* generation */
 
+#define PERL_VERSION_STRING    STRINGIFY(PERL_REVISION) "." \
+                               STRINGIFY(PERL_VERSION) "." \
+                               STRINGIFY(PERL_SUBVERSION)
+
 /* The following numbers describe the earliest compatible version of
    Perl ("compatibility" here being defined as sufficient binary/API
    compatibility to run XS code built with the older version).
diff --git a/perl.c b/perl.c
index 5987899..daf4208 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -415,8 +415,7 @@ perl_construct(pTHXx)
 
     PL_stashcache = newHV();
 
-    PL_patchlevel = Perl_newSVpvf(aTHX_ "v%d.%d.%d", (int)PERL_REVISION,
-                                 (int)PERL_VERSION, (int)PERL_SUBVERSION);
+    PL_patchlevel = newSVpvs("v" PERL_VERSION_STRING);
 
 #ifdef HAS_MMAP
     if (!PL_mmap_page_size) {