summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorTomoyuki Sahara <[email protected]>2017-04-06 10:25:06 +0900
committerGitHub <[email protected]>2017-04-06 10:25:06 +0900
commit7e014efe45ac7c8f5a0418b6f180634d33e0a9dd (patch)
tree398dba28e52ed6eaa9ea387cf5cf488eb652d477 /src
parent88a7fedea413568a1ff0410e109ff55a03b63a5f (diff)
parentd83e15e866d38cabbaad7c0f29cd93ef97be43b5 (diff)
downloadmruby-7e014efe45ac7c8f5a0418b6f180634d33e0a9dd.tar.gz
mruby-7e014efe45ac7c8f5a0418b6f180634d33e0a9dd.zip
Merge pull request #14 from ksss/to_int
Should use `to_int` instead of `to_i`
Diffstat (limited to 'src')
-rw-r--r--src/pack.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/pack.c b/src/pack.c
index 6a0075f5a..5a5b97b75 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -1018,11 +1018,7 @@ mrb_pack_pack(mrb_state *mrb, mrb_value ary)
o = mrb_ary_ref(mrb, ary, aidx);
if (type == PACK_TYPE_INTEGER) {
- if (mrb_float_p(o)) {
- o = mrb_funcall(mrb, o, "to_i", 0);
- } else if (!mrb_fixnum_p(o)) {
- mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %S into Integer", mrb_class_path(mrb, mrb_obj_class(mrb, o)));
- }
+ o = mrb_to_int(mrb, o);
} else if (type == PACK_TYPE_FLOAT) {
if (!mrb_float_p(o)) {
o = mrb_funcall(mrb, o, "to_f", 0);