Commit 1d4b26ec authored by Carson McDonald's avatar Carson McDonald

Add arena save/restore around use of hash KEY.

parent cf840c1d
......@@ -145,7 +145,9 @@ mrb_hash_set(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value val) /* mr
k = kh_get(ht, h, key);
if (k == kh_end(h)) {
/* expand */
int ai = mrb_gc_arena_save(mrb);
k = kh_put(ht, h, KEY(key));
mrb_gc_arena_restore(mrb, ai);
}
kh_value(h, k) = val;
......@@ -169,7 +171,9 @@ mrb_hash_dup(mrb_state *mrb, mrb_value hash)
for (k = kh_begin(h); k != kh_end(h); k++) {
if (kh_exist(h,k)) {
int ai = mrb_gc_arena_save(mrb);
ret_k = kh_put(ht, ret_h, KEY(kh_key(h,k)));
mrb_gc_arena_restore(mrb, ai);
kh_val(ret_h, ret_k) = kh_val(h,k);
}
}
......
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