ruby-changes:7924
From: tadf <ko1@a...>
Date: Sun, 21 Sep 2008 18:07:40 +0900 (JST)
Subject: [ruby-changes:7924] Ruby:r19445 (trunk): * complex.c (nucomp_s_convert): checks argc.
tadf 2008-09-21 18:07:25 +0900 (Sun, 21 Sep 2008) New Revision: 19445 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19445 Log: * complex.c (nucomp_s_convert): checks argc. * rational.c (nurat_s_convert): ditto. Modified files: trunk/ChangeLog trunk/complex.c trunk/rational.c Index: complex.c =================================================================== --- complex.c (revision 19444) +++ complex.c (revision 19445) @@ -1226,10 +1226,9 @@ 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 @@ 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; } Index: ChangeLog =================================================================== --- ChangeLog (revision 19444) +++ ChangeLog (revision 19445) @@ -1,3 +1,9 @@ +Sun Sep 21 18:06:38 2008 Tadayoshi Funaba <tadf@d...> + + * complex.c (nucomp_s_convert): checks argc. + + * rational.c (nurat_s_convert): ditto. + Sun Sep 21 10:19:04 2008 Tadayoshi Funaba <tadf@d...> * complex.c (nucomp_s_canonicalize_internal): checks exactness of Index: rational.c =================================================================== --- rational.c (revision 19444) +++ rational.c (revision 19445) @@ -1400,10 +1400,9 @@ static VALUE nurat_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); switch (TYPE(a1)) { case T_COMPLEX: @@ -1448,11 +1447,11 @@ switch (TYPE(a1)) { case T_RATIONAL: - if (c == 1 || (k_exact_p(a2) && f_one_p(a2))) + if (argc == 1 || (k_exact_p(a2) && f_one_p(a2))) return a1; } - if (c == 1) { + if (argc == 1) { if (k_numeric_p(a1) && !f_integer_p(a1)) return a1; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/