From a46544a4f9d31a2df3f9f2538de3fcb9715231fc Mon Sep 17 00:00:00 2001 From: tadf Date: Sun, 21 Sep 2008 09:07:25 +0000 Subject: * complex.c (nucomp_s_convert): checks argc. * rational.c (nurat_s_convert): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- complex.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'complex.c') diff --git a/complex.c b/complex.c index 442aa69586..52acce544f 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; } -- cgit v1.2.3