From ad9e841c5359efdd37a132767e03ad7a2d5ae72e Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Thu, 24 May 2012 01:09:36 +0900 Subject: made mrb_get_args() better (optinal args, type checks); close #173 #176 --- src/numeric.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/numeric.c') diff --git a/src/numeric.c b/src/numeric.c index a959718dd..09d55a5de 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -306,6 +306,7 @@ static mrb_value num_eql(mrb_state *mrb, mrb_value x) { mrb_value y; + mrb_get_args(mrb, "o", &y); if (mrb_type(x) != mrb_type(y)) return mrb_false_value(); if (mrb_equal(mrb, x, y)) { @@ -942,8 +943,8 @@ fix_xor(mrb_state *mrb, mrb_value x) { mrb_value y; mrb_int val; - mrb_get_args(mrb, "o", &y); + mrb_get_args(mrb, "o", &y); y = bit_coerce(mrb, y); val = mrb_fixnum(x) ^ mrb_fixnum(y); return mrb_fixnum_value(val); @@ -965,8 +966,8 @@ mrb_fix_lshift(mrb_state *mrb, mrb_value x) { mrb_value y; mrb_int val, width; - mrb_get_args(mrb, "o", &y); + mrb_get_args(mrb, "o", &y); val = mrb_fixnum(x); y = bit_coerce(mrb, y); width = mrb_fixnum(y); @@ -1000,8 +1001,8 @@ mrb_fix_rshift(mrb_state *mrb, mrb_value x) { mrb_value y; mrb_int i, val; - mrb_get_args(mrb, "o", &y); + mrb_get_args(mrb, "o", &y); val = mrb_fixnum(x); y = bit_coerce(mrb, y); i = mrb_fixnum(y); -- cgit v1.2.3