Skip to content

Commit

Permalink
Use mrb_funcall_argv() instead of mrb_funcall()
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Feb 15, 2017
1 parent ba812d2 commit 0429692
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,20 @@ mrb_hash_get(mrb_state *mrb, mrb_value hash, mrb_value key)
{
khash_t(ht) *h = RHASH_TBL(hash);
khiter_t k;
mrb_sym mid;

if (h) {
k = kh_get(ht, mrb, h, key);
if (k != kh_end(h))
return kh_value(h, k).v;
}

if (mrb_func_basic_p(mrb, hash, mrb_intern_lit(mrb, "default"), mrb_hash_default)) {
mid = mrb_intern_lit(mrb, "default");
if (mrb_func_basic_p(mrb, hash, mid, mrb_hash_default)) {
return hash_default(mrb, hash, key);
}
/* xxx mrb_funcall_tailcall(mrb, hash, "default", 1, key); */
return mrb_funcall(mrb, hash, "default", 1, key);
return mrb_funcall_argv(mrb, hash, mid, 1, &key);
}

MRB_API mrb_value
Expand Down

0 comments on commit 0429692

Please sign in to comment.