summaryrefslogtreecommitdiffhomepage
path: root/src/object.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-12-29 16:23:33 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-12-29 16:39:29 +0900
commit4f297ac29cec0c12aae1f7fd56390fdb6b925547 (patch)
tree784efb6605d34bae3267be8908d35acbf5f96eb4 /src/object.c
parentb6283978c586702e1b2ff182b83ceb3e2bf691b3 (diff)
downloadmruby-4f297ac29cec0c12aae1f7fd56390fdb6b925547.tar.gz
mruby-4f297ac29cec0c12aae1f7fd56390fdb6b925547.zip
object.c: introduce `mrb_ensure_{int,float}_type`.
Since `mrb_to_integer` and `mrb_to_float` does not convert the object but checks types, they are named so by historical reason. We introduced properly named functions. This commit obsoletes the following functions: * mrb_to_integer() * mrb_to_int() * mrb_to_float() Use `mrb_ensure_int_type()` instead for the first 2 functions. Use `mrb_ensure_float_type()` for the last.
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/object.c b/src/object.c
index 44af8f745..2b0c4e11f 100644
--- a/src/object.c
+++ b/src/object.c
@@ -485,7 +485,7 @@ mrb_obj_is_kind_of(mrb_state *mrb, mrb_value obj, struct RClass *c)
}
MRB_API mrb_value
-mrb_to_integer(mrb_state *mrb, mrb_value val)
+mrb_ensure_int_type(mrb_state *mrb, mrb_value val)
{
if (!mrb_integer_p(val)) {
#ifndef MRB_NO_FLOAT
@@ -500,7 +500,7 @@ mrb_to_integer(mrb_state *mrb, mrb_value val)
#ifndef MRB_NO_FLOAT
MRB_API mrb_value
-mrb_to_float(mrb_state *mrb, mrb_value val)
+mrb_ensure_float_type(mrb_state *mrb, mrb_value val)
{
if (mrb_nil_p(val)) {
mrb_raise(mrb, E_TYPE_ERROR, "can't convert nil into Float");