From 8ffd4e47fb1c18088e554d31e8af88881517a201 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 22 Sep 2018 23:05:52 +0900 Subject: Use `mrb_undef_value` for delete mark instead of shifting Hash entry table. That means entry table should be compacted periodically by `sg_compact()`. --- mrbgems/mruby-hash-ext/mrblib/hash.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mrbgems/mruby-hash-ext') diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index 61e4c890c..5bbbdf559 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -461,9 +461,9 @@ class Hash return to_enum :transform_keys! unless block self.keys.each do |k| value = self[k] - new_key = block.call(k) self.__delete(k) - self[new_key] = value + k = block.call(k) if block + self[k] = value end self end -- cgit v1.2.3