Skip to content

Commit 5facbfc

Browse files
committed
Prefer keyword arguments
1 parent 8c8b0b6 commit 5facbfc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/io/console/console.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t *
111111
int argc = *argcp;
112112
rawmode_arg_t *optp = NULL;
113113
VALUE vopts = Qnil;
114+
#ifdef RB_SCAN_ARGS_PASS_CALLED_KEYWORDS
115+
argc = rb_scan_args(argc, argv, "*:", NULL, &vopts);
116+
#else
114117
if (argc > min_argc) {
115118
vopts = rb_check_hash_type(argv[argc-1]);
116119
if (!NIL_P(vopts)) {
@@ -120,6 +123,7 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t *
120123
if (!vopts) vopts = Qnil;
121124
}
122125
}
126+
#endif
123127
rb_check_arity(argc, min_argc, max_argc);
124128
if (!NIL_P(vopts)) {
125129
VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min));

0 commit comments

Comments
 (0)