summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-04-28 15:15:28 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-04-28 15:15:28 +0900
commit0fee6e1ee98725e117e04b33440af395ea8e0491 (patch)
tree4f13526a86971ec86282cad2c7d453c72dc4a8f5 /src/string.c
parent50a9c5d7c704e84c6bdec9affa270824fed02034 (diff)
downloadmruby-0fee6e1ee98725e117e04b33440af395ea8e0491.tar.gz
mruby-0fee6e1ee98725e117e04b33440af395ea8e0491.zip
Fix broken support of `MRB_WITHOUT_FLOAT`; fix #4015
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c
index 8ebd11b6c..e4bfd034c 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2167,10 +2167,13 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base,
n *= base;
n += c;
if (n > (uint64_t)MRB_INT_MAX + (sign ? 0 : 1)) {
+#ifndef MRB_WITHOUT_FLOAT
if (base == 10) {
return mrb_float_value(mrb, mrb_str_to_dbl(mrb, mrb_str_new(mrb, str, len), badcheck));
}
- else {
+ else
+#endif
+ {
mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer",
mrb_str_new(mrb, str, pend-str));
}