[前][次][番号順一覧][スレッド一覧]

ruby-changes:60073

From: Nobuyoshi <ko1@a...>
Date: Fri, 14 Feb 2020 20:31:12 +0900 (JST)
Subject: [ruby-changes:60073] 78282d4655 (master): [ruby/io-console] Prefer keyword arguments

https://git.ruby-lang.org/ruby.git/commit/?id=78282d4655

From 78282d4655c05348ce7df24058623d3e868a08e6 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 14 Feb 2020 15:59:36 +0900
Subject: [ruby/io-console] Prefer keyword arguments

https://github.com/ruby/io-console/commit/5facbfc4c8

diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index bfba1e7..f67e680 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 * https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L111
     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 * https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L123
 	    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));
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]