summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-04 09:13:57 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-04 09:13:57 +0000
commita4934a42cbb84b6679912226581c71b435671f55 (patch)
tree786c2a292058c36491b5bee098ebe5a0d0b4f00a /array.c
parent89d1dff3439044201c36f601e1b1fb3b906132db (diff)
* io.c (read_all): fptr->f may be NULL, if IO is closed in the
signal handler. * io.c (io_read): ditto. * string.c (get_pat): remove 1.8.0 warning code. * string.c (rb_str_match): extend warning until 1.8.2. * string.c (rb_str_match2): ditto. * class.c (class_instance_method_list): remove 1.8.0 warnings. method_list now recurs. [ruby-dev:21816] * class.c (rb_obj_singleton_methods): ditto. * array.c (rb_ary_select): remove select with block. [ruby-dev:21824] * hash.c (rb_hash_select): ditto. * hash.c (env_select): ditto. * re.c (match_select): ditto. * struct.c (rb_struct_select): ditto. * process.c (check_uid_switch): remove duplicated error messages. * process.c (check_gid_switch): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/array.c b/array.c
index ed562060d2..ac2bb7d265 100644
--- a/array.c
+++ b/array.c
@@ -254,8 +254,8 @@ rb_ary_initialize(argc, argv, ary)
if (rb_block_given_p()) {
long i;
- if (argc > 1) {
- rb_raise(rb_eArgError, "wrong number of arguments");
+ if (argc == 2) {
+ rb_warn("block supersedes default value argument");
}
for (i=0; i<len; i++) {
RARRAY(ary)->ptr[i] = rb_yield(LONG2NUM(i));
@@ -655,8 +655,7 @@ rb_ary_indexes(argc, argv, ary)
VALUE new_ary;
long i;
- rb_warn("Array#%s is deprecated; use Array#values_at",
- rb_id2name(rb_frame_last_func()));
+ rb_warn("Array#%s is deprecated; use Array#values_at", rb_id2name(rb_frame_last_func()));
new_ary = rb_ary_new2(argc);
for (i=0; i<argc; i++) {
rb_ary_push(new_ary, rb_ary_aref(1, argv+i, ary));
@@ -1270,10 +1269,6 @@ rb_ary_select(argc, argv, ary)
VALUE result;
long i;
- if (!rb_block_given_p()) {
- rb_warn("Array#select(index..) is deprecated; use Array#values_at");
- return rb_ary_values_at(argc, argv, ary);
- }
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments (%d for 0)", argc);
}