readfloat.c (mrb_read_float): a new function.

We no longer use `mrb_float_read()` that depends on `errno`.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-11-07 13:42:30 +09:00
parent 4e9773ae3d
commit 4a888a34bb
7 changed files with 1047 additions and 1061 deletions
+1 -2
View File
@@ -2572,8 +2572,7 @@ mrb_str_len_to_dbl(mrb_state *mrb, const char *s, size_t len, mrb_bool badcheck)
p = buf;
pend = n;
nocopy:
d = mrb_float_read(p, &end);
if (p == end) {
if (mrb_read_float(p, &end, &d) == FALSE) {
if (badcheck) {
bad:
mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid string for float(%!s)", s);