summaryrefslogtreecommitdiffhomepage
path: root/src/numeric.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-06-15 16:19:16 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-06-15 16:19:16 +0900
commit7c8a91ff5a41edbc04183042e772e16073fb61ba (patch)
treeb9e3b117bc2082a6c4eba791c90cf125bc74004b /src/numeric.c
parent50b6fafddf2fa37727e812fbda8b7a61a8ca1ca1 (diff)
downloadmruby-7c8a91ff5a41edbc04183042e772e16073fb61ba.tar.gz
mruby-7c8a91ff5a41edbc04183042e772e16073fb61ba.zip
numeric.c: restore `fmt` argument for backward compatibility.
`mrb_float_to_str()` used to take `fmt` argument. We thought no one used the function, and OK to remove the argument. But at least `mruby-redis` gem used the function.
Diffstat (limited to 'src/numeric.c')
-rw-r--r--src/numeric.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/numeric.c b/src/numeric.c
index a38301caa..b377ce0e6 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -277,8 +277,9 @@ flo_div(mrb_state *mrb, mrb_value x)
return mrb_float_value(mrb, a);
}
-MRB_API mrb_value
-mrb_float_to_str(mrb_state *mrb, mrb_value flo)
+/* the argument `fmt` is no longer used; you can pass `NULL` */
+mrb_value
+mrb_float_to_str(mrb_state *mrb, mrb_value flo, const char *fmt)
{
char buf[25];
#ifdef MRB_USE_FLOAT32
@@ -330,7 +331,7 @@ flo_to_s(mrb_state *mrb, mrb_value flt)
str = mrb_str_new_lit(mrb, "NaN");
}
else {
- str = mrb_float_to_str(mrb, flt);
+ str = mrb_float_to_str(mrb, flt, NULL);
}
RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));