Use mrb_get_arg1() instead of mrb_get_args() for single argument

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-02-21 16:33:15 +09:00
parent aecbdf72bf
commit a21edf75ad
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -1177,9 +1177,8 @@ mrb_str_del_suffix(mrb_state *mrb, mrb_value self)
static mrb_value
mrb_str_casecmp(mrb_state *mrb, mrb_value self)
{
mrb_value str;
mrb_value str = mrb_get_arg1(mrb);
mrb_get_args(mrb, "o", &str);
if (!mrb_string_p(str)) return mrb_nil_value();
struct RString *s1 = mrb_str_ptr(self);
@@ -56,9 +56,8 @@ istruct_test_test_receive(mrb_state *mrb, mrb_value self)
static mrb_value
istruct_test_test_receive_direct(mrb_state *mrb, mrb_value self)
{
mrb_value is;
mrb_value is = mrb_get_arg1(mrb);
struct RClass *klass = mrb_class_get(mrb, "InlineStructTest");
mrb_get_args(mrb, "o", &is);
/* if you need to protect istruct retrieval from untrusted code,
you need to care about class replacing.
See mrbgem/mruby-random/src/random.c for detail */