summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-test
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-08-03 11:54:45 +0900
committerKOBAYASHI Shuji <[email protected]>2019-08-03 11:54:45 +0900
commita4243360a2f8248dbf23b46ca14a7a59c0479b32 (patch)
treef1610224880c12bf374f11851c59d3f6474a6638 /mrbgems/mruby-test
parentc883f4e332f2385fc9c9df7162b336ea601ec459 (diff)
downloadmruby-a4243360a2f8248dbf23b46ca14a7a59c0479b32.tar.gz
mruby-a4243360a2f8248dbf23b46ca14a7a59c0479b32.zip
Fix `mrb_vformat("%f")` with `MRB_USE_FLOAT`
It potentially not work when `mrb_float` is `float` because `float` variable in variable length arguments is promoted to `double`. Also I fixed build with `MRB_WITHOUT_FLOAT`.
Diffstat (limited to 'mrbgems/mruby-test')
-rw-r--r--mrbgems/mruby-test/vformat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mrbgems/mruby-test/vformat.c b/mrbgems/mruby-test/vformat.c
index e6581d6be..e02383f77 100644
--- a/mrbgems/mruby-test/vformat.c
+++ b/mrbgems/mruby-test/vformat.c
@@ -4,6 +4,11 @@
#include <mruby/data.h>
#include <mruby/string.h>
+#ifdef MRB_WITHOUT_FLOAT
+typedef mrb_int mrb_float;
+#define mrb_float(o) mrb_fixnum(o)
+#endif
+
#define NATIVE_TYPES \
char c; \
int d; \