From: Bruno Haible Date: Sun, 22 Jun 2025 00:16:38 +0000 (+0200) Subject: perl-format: Accept null precision. X-Git-Tag: v0.26~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c4aff9b3b66a2f2e790a6da86821dc1fb826933;p=thirdparty%2Fgettext.git perl-format: Accept null precision. Proof that it's valid: $ perl printf "%.f", 3.1415926535 * gettext-tools/src/format-perl.c: Clarify comment regarding the precision. * gettext-tools/tests/format-perl-1: Add a test case with null precision. --- diff --git a/gettext-tools/src/format-perl.c b/gettext-tools/src/format-perl.c index f6e11d075..5e37a8334 100644 --- a/gettext-tools/src/format-perl.c +++ b/gettext-tools/src/format-perl.c @@ -46,7 +46,7 @@ a nonempty digit sequence starting with a nonzero digit, - is optionally followed by '.' and a precision specification: '*' (reads an argument) or '*m$' where m is a positive integer starting with a - nonzero digit or a digit sequence, + nonzero digit or an optional nonempty digit sequence, - is optionally followed by a size specifier, one of 'h' 'l' 'll' 'L' 'q' 'V' 'I32' 'I64' 'I', - is finished by a specifier diff --git a/gettext-tools/tests/format-perl-1 b/gettext-tools/tests/format-perl-1 index 090795a75..119ecb310 100755 --- a/gettext-tools/tests/format-perl-1 +++ b/gettext-tools/tests/format-perl-1 @@ -88,6 +88,8 @@ cat <<\EOF > f-pl-1.data "abc%y" # Invalid: flags after width "abc%*0g" +# Valid: null precision +"abc%.f" # Invalid: twice precision "abc%.4.2g" # Valid: three arguments