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

ruby-changes:59741

From: Nobuyoshi <ko1@a...>
Date: Sat, 18 Jan 2020 18:56:12 +0900 (JST)
Subject: [ruby-changes:59741] eb96e4e981 (master): Made glob option keyword IDs static

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

From eb96e4e98150435f1473afcef20d231f80724b47 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 18 Jan 2020 18:14:47 +0900
Subject: Made glob option keyword IDs static


diff --git a/dir.c b/dir.c
index 56dfe61..6734559 100644
--- a/dir.c
+++ b/dir.c
@@ -2755,10 +2755,12 @@ dir_globs(long argc, const VALUE *argv, VALUE base, int flags) https://github.com/ruby/ruby/blob/trunk/dir.c#L2755
 static void
 dir_glob_options(VALUE opt, VALUE *base, int *flags)
 {
-    ID kw[2];
+    static ID kw[2];
     VALUE args[2];
-    kw[0] = rb_intern("base");
-    if (flags) kw[1] = rb_intern("flags");
+    if (!kw[0]) {
+        kw[0] = rb_intern_const("base");
+        kw[1] = rb_intern_const("flags");
+    }
     rb_get_kwargs(opt, kw, 0, flags ? 2 : 1, args);
     if (args[0] == Qundef || NIL_P(args[0])) {
 	*base = Qnil;
-- 
cgit v0.10.2


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

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