Refactor the `mrb_get_args()` function
- Removed the `ARGV` macro. The current path doesn't go into the mruby VM and there's also no need to separate variables. - Use common functions to check object types. - Use `mrb_ensure_string_type()` to check the string instead of `mrb_to_str()`. This is for consistency with array and hash. - Use `mrb_ensure_array_type()` to check the array instead of `to_ary()`. - Use `mrb_ensure_hash_type()` to check the hash instead of `to_hash()`. - Add and use `ensure_class_type()` to check class and module. - Changed the argument index type from `mrb_int` to `int`. Even if it is `int16_t`, it is enough. `mrb_int` is overkill, especially if `MRB_32BIT` and `MRB_INT64` are defined.
Showing
Please register or sign in to comment