From 4ce4f43f914dd8988bc7c78a30641d1911d20b98 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 26 Dec 2013 05:28:24 +0000 Subject: [PATCH] hash.c: remove dead code * hash.c (rb_hash_reject): remove dead code for the deprecated behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- hash.c | 27 +-------------------------- test/ruby/test_hash.rb | 12 ------------ 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/hash.c b/hash.c index 004ee920e3..279461f8f4 100644 --- a/hash.c +++ b/hash.c @@ -31,7 +31,6 @@ ((klass = has_extra_methods(rb_obj_class(hash))) != 0) || \ FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \ !NIL_P(RHASH_IFNONE(hash))) -#define HASH_REJECT_COPY_EXTRA_STATES 0 static VALUE has_extra_methods(VALUE klass) @@ -291,7 +290,7 @@ rb_hash_new(void) return hash_alloc(rb_cHash); } -static VALUE +static inline VALUE rb_hash_dup_empty(VALUE hash) { NEWOBJ_OF(ret, struct RHash, @@ -1146,34 +1145,10 @@ rb_hash_reject(VALUE hash) if (RTEST(ruby_verbose)) { VALUE klass; if (HAS_EXTRA_STATES(hash, klass)) { -#if HASH_REJECT_COPY_EXTRA_STATES - rb_warn("copying extra states: %+"PRIsVALUE, hash); - rb_warn("following states will not be copied in the future version:"); - if (klass) { - rb_warn(" subclass: %+"PRIsVALUE, klass); - } - if (FL_TEST(hash, FL_EXIVAR)) { - rb_warn(" instance variables: %+"PRIsVALUE, - rb_obj_instance_variables(hash)); - } - if (FL_TEST(hash, FL_TAINT)) { - rb_warn(" taintedness"); - } - if (FL_TEST(hash, HASH_PROC_DEFAULT)) { - rb_warn(" default proc: %+"PRIsVALUE, RHASH_IFNONE(hash)); - } - else if (!NIL_P(RHASH_IFNONE(hash))) - rb_warn(" default value: %+"PRIsVALUE, RHASH_IFNONE(hash)); -#else rb_warn("extra states are no longer copied: %+"PRIsVALUE, hash); -#endif } } -#if HASH_REJECT_COPY_EXTRA_STATES - result = rb_hash_dup_empty(hash); -#else result = rb_hash_new(); -#endif if (!RHASH_EMPTY_P(hash)) { rb_hash_foreach(hash, reject_i, result); } diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 8e0de3cc5d..70c04424db 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -558,18 +558,6 @@ class TestHash < Test::Unit::TestCase assert_equal(h3, h.reject {|k,v| v }) assert_equal(base, h) - unless RUBY_VERSION > "2.1.0" - if @cls == Hash - assert_empty(EnvUtil.verbose_warning {h.reject {false}}) - bug9275 = '[ruby-core:59254] [Bug #9275]' - c = Class.new(Hash) - assert_empty(EnvUtil.verbose_warning {c.new.reject {false}}, bug9275) - else - assert_match(/extra states/, EnvUtil.verbose_warning {h.reject {false}}) - end - return - end - h.instance_variable_set(:@foo, :foo) h.default = 42 h.taint