Commit 44eb1492 authored by Kazuho Oku's avatar Kazuho Oku

freeze the hash key (fixes #2945)

parent 1cbbb7e1
...@@ -104,9 +104,11 @@ static void mrb_hash_modify(mrb_state *mrb, mrb_value hash); ...@@ -104,9 +104,11 @@ static void mrb_hash_modify(mrb_state *mrb, mrb_value hash);
static inline mrb_value static inline mrb_value
mrb_hash_ht_key(mrb_state *mrb, mrb_value key) mrb_hash_ht_key(mrb_state *mrb, mrb_value key)
{ {
if (mrb_string_p(key)) if (mrb_string_p(key)) {
return mrb_str_dup(mrb, key); key = mrb_str_dup(mrb, key);
else RSTR_SET_FROZEN_FLAG(mrb_str_ptr(key));
return key;
} else
return key; return key;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment