mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
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:
1 parent
cee53c1430
commit
cfe3602ad6
1 file changed
+5
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user