diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-02-14 15:59:36 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-02-14 20:30:34 +0900 |
commit | 78282d4655c05348ce7df24058623d3e868a08e6 (patch) | |
tree | 0928f08b2eba4868729bc13809bfebd3a7197079 /ext | |
parent | 1df2c8cefb4bb9a36f5241b407ebb13f7550669f (diff) | |
download | ruby-78282d4655c05348ce7df24058623d3e868a08e6.tar.gz |
[ruby/io-console] Prefer keyword arguments
https://github.com/ruby/io-console/commit/5facbfc4c8
Diffstat (limited to 'ext')
-rw-r--r-- | ext/io/console/console.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c index bfba1e7152..f67e6805bc 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -111,6 +111,9 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t * int argc = *argcp; rawmode_arg_t *optp = NULL; VALUE vopts = Qnil; +#ifdef RB_SCAN_ARGS_PASS_CALLED_KEYWORDS + argc = rb_scan_args(argc, argv, "*:", NULL, &vopts); +#else if (argc > min_argc) { vopts = rb_check_hash_type(argv[argc-1]); if (!NIL_P(vopts)) { @@ -120,6 +123,7 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t * if (!vopts) vopts = Qnil; } } +#endif rb_check_arity(argc, min_argc, max_argc); if (!NIL_P(vopts)) { VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min)); |