mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
freeze the hash key (fixes #2945)
This commit is contained in:
+5
-3
@@ -104,9 +104,11 @@ static void mrb_hash_modify(mrb_state *mrb, mrb_value hash);
|
||||
static inline mrb_value
|
||||
mrb_hash_ht_key(mrb_state *mrb, mrb_value key)
|
||||
{
|
||||
if (mrb_string_p(key))
|
||||
return mrb_str_dup(mrb, key);
|
||||
else
|
||||
if (mrb_string_p(key)) {
|
||||
key = mrb_str_dup(mrb, key);
|
||||
RSTR_SET_FROZEN_FLAG(mrb_str_ptr(key));
|
||||
return key;
|
||||
} else
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user