Skip to content

Commit

Permalink
Prefer keyword arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Feb 14, 2020
1 parent 8c8b0b6 commit b14957f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/io/console/console.c
Expand Up @@ -111,6 +111,11 @@ 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
if (argc > 0) {
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)) {
Expand All @@ -120,6 +125,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));
Expand Down

0 comments on commit b14957f

Please sign in to comment.