summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-hash-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-09-22 23:05:52 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-09-26 23:09:48 +0900
commit8ffd4e47fb1c18088e554d31e8af88881517a201 (patch)
treea21688b128eb1f6fe5f3fb2007d359466c3956d7 /mrbgems/mruby-hash-ext
parente8dcfe17454eb88f266f90cf31ca562e30378291 (diff)
downloadmruby-8ffd4e47fb1c18088e554d31e8af88881517a201.tar.gz
mruby-8ffd4e47fb1c18088e554d31e8af88881517a201.zip
Use `mrb_undef_value` for delete mark instead of shifting Hash entry table.
That means entry table should be compacted periodically by `sg_compact()`.
Diffstat (limited to 'mrbgems/mruby-hash-ext')
-rw-r--r--mrbgems/mruby-hash-ext/mrblib/hash.rb4
1 files changed, 2 insertions, 2 deletions
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