diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-10-22 22:49:12 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-10-23 14:47:55 +0900 |
| commit | 9540a8309c451ab92fc105ff10868a720e5ec315 (patch) | |
| tree | bac0843fe911a0ab00d395ce10cd5ce943fe56f9 | |
| parent | 11184e9186f26264b7d453dce56c9a16f2f59b15 (diff) | |
| download | mruby-9540a8309c451ab92fc105ff10868a720e5ec315.tar.gz mruby-9540a8309c451ab92fc105ff10868a720e5ec315.zip | |
Remove unnecessary `mrb_funcall()`.
| -rw-r--r-- | mrbgems/mruby-io/src/io.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/mrbgems/mruby-io/src/io.c b/mrbgems/mruby-io/src/io.c index 9474011ce..3a6932b3a 100644 --- a/mrbgems/mruby-io/src/io.c +++ b/mrbgems/mruby-io/src/io.c @@ -284,12 +284,13 @@ mrb_io_alloc(mrb_state *mrb) #endif static int -option_to_fd(mrb_state *mrb, mrb_value obj, const char *key) +option_to_fd(mrb_state *mrb, mrb_value hash, const char *key) { - mrb_value opt = mrb_funcall(mrb, obj, "[]", 1, mrb_symbol_value(mrb_intern_static(mrb, key, strlen(key)))); - if (mrb_nil_p(opt)) { - return -1; - } + mrb_value opt; + + if (!mrb_hash_p(hash)) return -1; + opt = mrb_hash_fetch(mrb, hash, mrb_symbol_value(mrb_intern_static(mrb, key, strlen(key))), mrb_nil_value()); + if (mrb_nil_p(opt)) return -1; switch (mrb_type(opt)) { case MRB_TT_DATA: /* IO */ |
