Add mrb_get_arg1() that retrieves single (and only) argument.

`mrb_get_arg1()` raises `ArgumentError` if the method does not receive one
argument.

And replaces all `mrb_get_args(mrb, "o", &arg)` by the new function.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-06-20 12:49:46 +09:00
parent 2ffb77586a
commit 49ae2a69f2
25 changed files with 130 additions and 209 deletions
+1 -2
View File
@@ -164,9 +164,8 @@ mrb_str_swapcase(mrb_state *mrb, mrb_value self)
static mrb_value
mrb_str_concat_m(mrb_state *mrb, mrb_value self)
{
mrb_value str;
mrb_value str = mrb_get_arg1(mrb);
mrb_get_args(mrb, "o", &str);
if (mrb_fixnum_p(str) || mrb_float_p(str))
#ifdef MRB_UTF8_STRING
str = int_chr_utf8(mrb, str);