summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-17 08:45:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-17 08:45:05 +0000
commit871472c72b4e0d6200b23329b191cf6d9636ae5f (patch)
tree82236af1be90551022f98eb99780ba12cf8d0b5f /ext
parent81442f903cab1cb2b7b4579a0300c37d193b27ba (diff)
Unnecessary checks
* ext/bigdecimal/bigdecimal.c: FIX2INT and FIX2UINT imply the check for Fixnum. * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/bigdecimal/bigdecimal.c9
-rw-r--r--ext/zlib/zlib.c3
2 files changed, 1 insertions, 11 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 3ccad9a..ebd452e 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -468,7 +468,6 @@ check_rounding_mode(VALUE const v)
break;
}
- Check_Type(v, T_FIXNUM);
sw = (unsigned short)FIX2UINT(v);
if (!VpIsRoundMode(sw)) {
rb_raise(rb_eArgError, "invalid rounding mode");
@@ -522,7 +521,6 @@ BigDecimal_mode(int argc, VALUE *argv, VALUE self)
unsigned long f,fo;
rb_scan_args(argc, argv, "11", &which, &val);
- Check_Type(which, T_FIXNUM);
f = (unsigned long)FIX2INT(which);
if (f & VP_EXCEPTION_ALL) {
@@ -593,7 +591,6 @@ static SIGNED_VALUE
GetPositiveInt(VALUE v)
{
SIGNED_VALUE n;
- Check_Type(v, T_FIXNUM);
n = FIX2INT(v);
if (n < 0) {
rb_raise(rb_eArgError, "argument must be positive");
@@ -1723,11 +1720,9 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
iLoc = 0;
break;
case 1:
- Check_Type(vLoc, T_FIXNUM);
iLoc = FIX2INT(vLoc);
break;
case 2:
- Check_Type(vLoc, T_FIXNUM);
iLoc = FIX2INT(vLoc);
sw = check_rounding_mode(vRound);
break;
@@ -1779,7 +1774,6 @@ BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
iLoc = 0;
}
else {
- Check_Type(vLoc, T_FIXNUM);
iLoc = FIX2INT(vLoc);
}
@@ -1840,7 +1834,6 @@ BigDecimal_floor(int argc, VALUE *argv, VALUE self)
iLoc = 0;
}
else {
- Check_Type(vLoc, T_FIXNUM);
iLoc = FIX2INT(vLoc);
}
@@ -1887,7 +1880,6 @@ BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
if (rb_scan_args(argc, argv, "01", &vLoc) == 0) {
iLoc = 0;
} else {
- Check_Type(vLoc, T_FIXNUM);
iLoc = FIX2INT(vLoc);
}
@@ -2631,7 +2623,6 @@ BigDecimal_limit(int argc, VALUE *argv, VALUE self)
if (rb_scan_args(argc, argv, "01", &nFig) == 1) {
int nf;
if (NIL_P(nFig)) return nCur;
- Check_Type(nFig, T_FIXNUM);
nf = FIX2INT(nFig);
if (nf < 0) {
rb_raise(rb_eArgError, "argument must be positive");
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 7f92eb6..4dfa2a5 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1363,7 +1363,6 @@ rb_zstream_set_avail_out(VALUE obj, VALUE size)
{
struct zstream *z = get_zstream(obj);
- Check_Type(size, T_FIXNUM);
zstream_expand_buffer_into(z, FIX2INT(size));
return size;
}
@@ -1449,7 +1448,7 @@ rb_zstream_closed_p(VALUE obj)
#define FIXNUMARG(val, ifnil) \
(NIL_P((val)) ? (ifnil) \
- : ((void)Check_Type((val), T_FIXNUM), FIX2INT((val))))
+ : (FIX2INT((val))))
#define ARG_LEVEL(val) FIXNUMARG((val), Z_DEFAULT_COMPRESSION)
#define ARG_WBITS(val) FIXNUMARG((val), MAX_WBITS)