summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-11-04 11:49:25 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-11-04 11:49:25 +0900
commitde2363a9f0c7d368ee9002f86931d124e644a243 (patch)
tree2112928a80786a109ecac4b3ce200f45ac75e2cb /src/string.c
parent388d26d77027feaa3e107abf7209e2681868bbe6 (diff)
parent625f9f6fa314872968632c5adbee7fb3823268b8 (diff)
downloadmruby-de2363a9f0c7d368ee9002f86931d124e644a243.tar.gz
mruby-de2363a9f0c7d368ee9002f86931d124e644a243.zip
Merge branch 'mrb_without_float' of https://github.com/pandax381/mruby into pandax381-mrb_without_float
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index c1e248dd9..8f0db681c 100644
--- a/src/string.c
+++ b/src/string.c
@@ -8,7 +8,9 @@
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
+#ifndef MRB_WITHOUT_FLOAT
#include <float.h>
+#endif
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
@@ -2256,6 +2258,7 @@ mrb_str_to_i(mrb_state *mrb, mrb_value self)
return mrb_str_to_inum(mrb, self, base, FALSE);
}
+#ifndef MRB_WITHOUT_FLOAT
MRB_API double
mrb_cstr_to_dbl(mrb_state *mrb, const char * p, mrb_bool badcheck)
{
@@ -2359,6 +2362,7 @@ mrb_str_to_f(mrb_state *mrb, mrb_value self)
{
return mrb_float_value(mrb, mrb_str_to_dbl(mrb, self, FALSE));
}
+#endif
/* 15.2.10.5.40 */
/*
@@ -2760,7 +2764,9 @@ mrb_init_string(mrb_state *mrb)
mrb_define_method(mrb, s, "slice", mrb_str_aref_m, MRB_ARGS_ANY()); /* 15.2.10.5.34 */
mrb_define_method(mrb, s, "split", mrb_str_split_m, MRB_ARGS_ANY()); /* 15.2.10.5.35 */
+#ifndef MRB_WITHOUT_FLOAT
mrb_define_method(mrb, s, "to_f", mrb_str_to_f, MRB_ARGS_NONE()); /* 15.2.10.5.38 */
+#endif
mrb_define_method(mrb, s, "to_i", mrb_str_to_i, MRB_ARGS_ANY()); /* 15.2.10.5.39 */
mrb_define_method(mrb, s, "to_s", mrb_str_to_s, MRB_ARGS_NONE()); /* 15.2.10.5.40 */
mrb_define_method(mrb, s, "to_str", mrb_str_to_s, MRB_ARGS_NONE());
@@ -2771,6 +2777,7 @@ mrb_init_string(mrb_state *mrb)
mrb_define_method(mrb, s, "bytes", mrb_str_bytes, MRB_ARGS_NONE());
}
+#ifndef MRB_WITHOUT_FLOAT
/*
* Source code for the "strtod" library procedure.
*
@@ -3015,3 +3022,4 @@ done:
}
return fraction;
}
+#endif