summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-16 08:15:21 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-16 08:15:21 +0000
commit0c6fdc530b2edac152a8430552df7b86bb1900ef (patch)
treea29901b42d2717500153650d6ab0aede1bb64f97
parent9a0b0747be2d5995e746568a97f4e345833f9fa9 (diff)
* array.c (rb_ary_nitems, rb_ary_choice): Add a deprecation
warning. * hash.c (env_index, rb_hash_index): Simplify the deprecation warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--array.c4
-rw-r--r--hash.c4
3 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f06afad953..cfb5bd4ca5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Dec 16 17:14:01 2008 Akinori MUSHA <[email protected]>
+
+ * array.c (rb_ary_nitems, rb_ary_choice): Add a deprecation
+ warning.
+
+ * hash.c (env_index, rb_hash_index): Simplify the deprecation
+ warnings.
+
Mon Dec 15 18:53:17 2008 Yukihiro Matsumoto <[email protected]>
* lib/sync.rb (Sync_m#sync_try_lock): wrong variable name fixed.
diff --git a/array.c b/array.c
index d063b06bd6..14edc9bad9 100644
--- a/array.c
+++ b/array.c
@@ -3067,6 +3067,8 @@ rb_ary_nitems(ary)
long n = 0;
VALUE *p, *pend;
+ rb_warn("Array#nitems is deprecated; use Array#count { |i| !i.nil? }");
+
for (p = RARRAY(ary)->ptr, pend = p + RARRAY(ary)->len; p < pend; p++) {
if (!NIL_P(*p)) n++;
}
@@ -3363,6 +3365,8 @@ rb_ary_choice(ary)
{
long i, j;
+ rb_warn("Array#choice is deprecated; use Array#sample");
+
i = RARRAY(ary)->len;
if (i == 0) return Qnil;
j = rb_genrand_real()*i;
diff --git a/hash.c b/hash.c
index f4297589d2..d7e0ab83fc 100644
--- a/hash.c
+++ b/hash.c
@@ -705,7 +705,7 @@ static VALUE
rb_hash_index(hash, value)
VALUE hash, value;
{
- rb_warning("Hash#index is deprecated and will be removed in 1.9; use Hash#key");
+ rb_warning("Hash#index is deprecated; use Hash#key");
return rb_hash_key(hash, value);
}
@@ -2484,7 +2484,7 @@ static VALUE
env_index(dmy, value)
VALUE dmy, value;
{
- rb_warning("ENV.index is deprecated and will be removed in 1.9; use ENV.key");
+ rb_warning("ENV.index is deprecated; use ENV.key");
return env_key(dmy, value);
}