mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-30 15:21:16 -03:00
math: Use wcstod_l
Locale-wise, we're only interested in one thing: "." is the radix character when interpreting numbers And for that it's enough to just use our c-locale, like elsewhere. This saves a bunch of switching locale back and forth, and simplifies the code.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
// This version has been altered and ported to C++ for inclusion in fish.
|
||||
#include "tinyexpr.h"
|
||||
#include "wutil.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
@@ -250,7 +251,7 @@ static void next_token(state *s) {
|
||||
|
||||
/* Try reading a number. */
|
||||
if ((s->next[0] >= '0' && s->next[0] <= '9') || s->next[0] == '.') {
|
||||
s->value = wcstod(s->next, const_cast<wchar_t **>(&s->next));
|
||||
s->value = wcstod_l(s->next, const_cast<wchar_t **>(&s->next), fish_c_locale());
|
||||
s->type = TOK_NUMBER;
|
||||
} else {
|
||||
/* Look for a function call. */
|
||||
|
||||
Reference in New Issue
Block a user