summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-print
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-06-20 12:49:46 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-06-20 12:49:46 +0900
commit49ae2a69f2c3acbb952406768320401cf1769425 (patch)
treefd0b49d898327a1de29e143fb2c68e6991cf710d /mrbgems/mruby-print
parent2ffb77586a8ce6f325d2981e2ad88cc9e62ae39b (diff)
downloadmruby-49ae2a69f2c3acbb952406768320401cf1769425.tar.gz
mruby-49ae2a69f2c3acbb952406768320401cf1769425.zip
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.
Diffstat (limited to 'mrbgems/mruby-print')
-rw-r--r--mrbgems/mruby-print/src/print.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c
index 66d070f60..9301dbe55 100644
--- a/mrbgems/mruby-print/src/print.c
+++ b/mrbgems/mruby-print/src/print.c
@@ -45,9 +45,8 @@ printstr(mrb_state *mrb, mrb_value obj)
mrb_value
mrb_printstr(mrb_state *mrb, mrb_value self)
{
- mrb_value argv;
+ mrb_value argv = mrb_get_arg1(mrb);
- mrb_get_args(mrb, "o", &argv);
printstr(mrb, argv);
return argv;