From baa00aa2506745308a598ce91e65a727ba25f30f Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 19 Dec 2002 09:20:20 +0000 Subject: * numeric.c (num_step): use DBL_EPSILON. * array.c (rb_check_array_type): new function: return an array (convert if possible), or nil. * string.c (rb_check_string_type): new function: return a string (convert if possible), or nil. * numeric.c (rb_dbl_cmp): returns nil if values are not comparable. * numeric.c (fix_cmp,flo_cmp): use rb_num_coerce_cmp() * bignum.c (rb_big_cmp): ditto. * numeric.c (rb_num_coerce_cmp): new coercing function for "<=>", which does not raise TypeError. * numeric.c (do_coerce): can be supress exception now. * object.c (rb_mod_cmp): should return nil for non class/module objects. * re.c (rb_reg_eqq): return false if the argument is not a string. now returns boolean value. * class.c (rb_include_module): argument should be T_MODULE, not T_class, nor T_ICLASS. * eval.c (is_defined): "defined?" should return "assignment" for attribute assignment (e.g. a.foo=b) and indexed assignment (e.g. a[2] = 44). * parse.y (aryset): use NODE_ATTRASGN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'array.c') diff --git a/array.c b/array.c index e6c605db14..927d4dcbde 100644 --- a/array.c +++ b/array.c @@ -204,6 +204,13 @@ to_ary(ary) return rb_convert_type(ary, T_ARRAY, "Array", "to_ary"); } +VALUE +rb_check_array_type(ary) + VALUE ary; +{ + return rb_check_convert_type(ary, T_ARRAY, "Array", "to_ary"); +} + static VALUE rb_ary_replace _((VALUE, VALUE)); static VALUE @@ -225,7 +232,7 @@ rb_ary_initialize(argc, argv, ary) } if (argc == 1 && !FIXNUM_P(size)) { - val = rb_check_convert_type(size, T_ARRAY, "Array", "to_ary"); + val = rb_check_array_type(size); if (!NIL_P(val)) { rb_ary_replace(ary, val); return ary; -- cgit v1.2.3