strtod, strtold: Use the locale's decimal point.
commit97e23d40a659c85048b59852e1871823f727aeb2
authorBruno Haible <bruno@clisp.org>
Fri, 1 Feb 2019 02:12:28 +0000 (1 03:12 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 1 Feb 2019 02:12:28 +0000 (1 03:12 +0100)
tree3af9ca8e63074de5b0b42826f24d18a4c5932dc5
parentcd825c6d50babc1f4fbaccfee3fff1785fe23cc3
strtod, strtold: Use the locale's decimal point.

* lib/strtod.c: Include <locale.h>, <stdio.h>, <langinfo.h>.
(decimal_point_char): New function, copied from lib/vasnprintf.c.
(parse_number): Add a radixchar argument. Use it instead of '.'.
(STRTOD): Invoke decimal_point_char and pass the result to parse_number.
* m4/strtod.m4 (gl_PREREQ_STRTOD): Test whether nl_langinfo exists.
* m4/strtold.m4 (gl_PREREQ_STRTOLD): Likewise.
* tests/test-strtod1.c: New file.
* tests/test-strtod1.sh: New file.
* modules/strtod-tests (Files): Add test-strtod1.{sh,c}. Add
locale-fr.m4 and its dependencies.
(configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8.
(Makefile.am): Arrange to compile test-strtod1.c and run
test-strtod1.sh.
* tests/test-strtold1.c: New file.
* tests/test-strtold1.sh: New file.
* modules/strtold-tests (Files): Add test-strtold1.{sh,c}. Add
locale-fr.m4 and its dependencies.
(configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8.
(Makefile.am): Arrange to compile test-strtold1.c and run
test-strtold1.sh.
ChangeLog
lib/strtod.c
m4/strtod.m4
m4/strtold.m4
modules/strtod-tests
modules/strtold-tests
tests/test-strtod1.c [new file with mode: 0644]
tests/test-strtod1.sh [new file with mode: 0755]
tests/test-strtold1.c [new file with mode: 0644]
tests/test-strtold1.sh [new file with mode: 0755]