Skip to content
Permalink
Browse files
Use mrb_funcall_argv() instead of mrb_funcall()
  • Loading branch information
matz committed Feb 15, 2017
1 parent ba812d2 commit 04296925ac81537e029af46ed7622471d8374ce8
Showing 1 changed file with 4 additions and 2 deletions.
@@ -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

0 comments on commit 0429692

Please sign in to comment.