summaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-21 09:07:25 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-21 09:07:25 +0000
commit482976cc242b1159b889c59a6d63a1b9d5a08eb6 (patch)
treec3b06721f0c41658a44d388ba89a6fd8465b6a10 /complex.c
parent8fe6e4269ef8923b73a035be4712ce8c65dd9eb4 (diff)
downloadruby-482976cc242b1159b889c59a6d63a1b9d5a08eb6.tar.gz
ruby-482976cc242b1159b889c59a6d63a1b9d5a08eb6.tar.xz
ruby-482976cc242b1159b889c59a6d63a1b9d5a08eb6.zip
* complex.c (nucomp_s_convert): checks argc.
* rational.c (nurat_s_convert): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/complex.c b/complex.c
index 442aa6958..52acce544 100644
--- a/complex.c
+++ b/complex.c
@@ -1226,10 +1226,9 @@ string_to_c(VALUE self)
static VALUE
nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
{
- int c;
VALUE a1, a2, backref;
- c = rb_scan_args(argc, argv, "02", &a1, &a2);
+ rb_scan_args(argc, argv, "11", &a1, &a2);
backref = rb_backref_get();
rb_match_busy(backref);
@@ -1278,11 +1277,11 @@ nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
switch (TYPE(a1)) {
case T_COMPLEX:
- if (c == 1 || (k_exact_p(a2) && f_zero_p(a2)))
+ if (argc == 1 || (k_exact_p(a2) && f_zero_p(a2)))
return a1;
}
- if (c == 1) {
+ if (argc == 1) {
if (k_numeric_p(a1) && !f_real_p(a1))
return a1;
}