From 49ae2a69f2c3acbb952406768320401cf1769425 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 20 Jun 2020 12:49:46 +0900 Subject: 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. --- mrbgems/mruby-complex/src/complex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mrbgems/mruby-complex') diff --git a/mrbgems/mruby-complex/src/complex.c b/mrbgems/mruby-complex/src/complex.c index 10fa42a2c..0432da633 100644 --- a/mrbgems/mruby-complex/src/complex.c +++ b/mrbgems/mruby-complex/src/complex.c @@ -174,7 +174,7 @@ div_pair(struct float_pair *q, struct float_pair const *a, static mrb_value complex_div(mrb_state *mrb, mrb_value self) { - mrb_value rhs; + mrb_value rhs = mrb_get_arg1(mrb); struct mrb_complex *a, *b; struct float_pair ar, ai, br, bi; struct float_pair br2, bi2; @@ -183,7 +183,6 @@ complex_div(mrb_state *mrb, mrb_value self) struct float_pair ai_br, ar_bi; struct float_pair zr, zi; - mrb_get_args(mrb, "o", &rhs); a = complex_ptr(mrb, self); b = complex_ptr(mrb, rhs); -- cgit v1.2.3