mktables: output floating pt as strings
authorKarl Williamson <public@khwilliamson.com>
Mon, 5 Sep 2011 04:12:11 +0000 (22:12 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 8 Nov 2011 15:09:18 +0000 (08:09 -0700)
mktables creates data structures on files that are later read in.  Some
of these are nominally floating point numbers, like 2.0.  But they are
actually version numbers, and if output without being quoted, they will
be read in as just an integer and a string compare will fail.  Actual
floating point numbers are also output, but if these are output enclosed
in quotes, they will be coerced into the correct data type when
necessary.

This fix doesn't correct any known existing problems, but is needed for
future commits.

lib/unicore/mktables

index ef8716a..2831436 100644 (file)
@@ -8330,9 +8330,8 @@ sub utf8_heavy_name ($$) {
             my $copy = $item;
             $copy = $UNDEF unless defined $copy;
 
-            # Quote non-numbers (numbers also have optional leading '-' and
-            # fractions)
-            if ($copy eq "" || $copy !~ /^ -? \d+ ( \. \d+ )? $/x) {
+            # Quote non-integers (integers also have optional leading '-')
+            if ($copy eq "" || $copy !~ /^ -? \d+ $/x) {
 
                 # Escape apostrophe and backslash
                 $copy =~ s/ ( ['\\] ) /\\$1/xg;