seq: solve e13188e7ef more cleanly

* src/seq.c (print_numbers): Don't switch c_strtold -> strtold
in order to accommodate the locale-dependent behavior of our internal
asprintf use.  Instead, simply set the locale to C before calling
asprintf, and then set it back afterwards.
This commit is contained in:
Jim Meyering committed 2008-09-29 15:28:03 +02:00
1 parent cee53c1430
commit cfe3602ad6
1 file changed
+5 -2
+5 -2
View File
@@ -301,12 +301,15 @@ print_numbers (char const *fmt, struct layout layout,
bool print_extra_number = false;
long double x_val;
char *x_str;
int x_strlen = asprintf (&x_str, fmt, x);
int x_strlen;
setlocale (LC_NUMERIC, "C");
x_strlen = asprintf (&x_str, fmt, x);
setlocale (LC_NUMERIC, "");
if (x_strlen < 0)
xalloc_die ();
x_str[x_strlen - layout.suffix_len] = '\0';
if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, strtold)
if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, c_strtold)
&& abs_rel_diff (x_val, last) < DBL_EPSILON)
{
char *x0_str = NULL;