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

ruby-changes:57208

From: Nobuyoshi <ko1@a...>
Date: Thu, 22 Aug 2019 00:20:29 +0900 (JST)
Subject: [ruby-changes:57208] Nobuyoshi Nakada: a963851100 (master): Hoisted out rb_id_metadata

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

From a9638511009bb8847dfb037d05bdbbdd685066e7 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 21 Aug 2019 16:41:06 +0900
Subject: Hoisted out rb_id_metadata


diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index b6f5a56..954ab81 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -735,7 +735,7 @@ Init_digest(void) https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L735
     id_digest          = rb_intern("digest");
     id_hexdigest       = rb_intern("hexdigest");
     id_digest_length   = rb_intern("digest_length");
-    id_metadata        = rb_intern("metadata");
+    id_metadata        = rb_id_metadata();
     InitVM(digest);
 }
 
diff --git a/ext/digest/digest.h b/ext/digest/digest.h
index d9997b5..4b69540 100644
--- a/ext/digest/digest.h
+++ b/ext/digest/digest.h
@@ -56,3 +56,9 @@ rb_digest_namespace(void) https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.h#L56
     rb_require("digest");
     return rb_path2class("Digest");
 }
+
+static inline ID
+rb_id_metadata(void)
+{
+    return rb_intern_const("metadata");
+}
diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c
index 99450bb..7d21178 100644
--- a/ext/digest/sha2/sha2init.c
+++ b/ext/digest/sha2/sha2init.c
@@ -35,15 +35,13 @@ void https://github.com/ruby/ruby/blob/trunk/ext/digest/sha2/sha2init.c#L35
 Init_sha2(void)
 {
     VALUE mDigest, cDigest_Base;
-    ID id_metadata;
+    ID id_metadata = rb_id_metadata();
 
 #define DECLARE_ALGO_CLASS(bitlen) \
     VALUE cDigest_SHA##bitlen;
 
     FOREACH_BITLEN(DECLARE_ALGO_CLASS)
 
-    id_metadata = rb_intern_const("metadata");
-
     mDigest = rb_digest_namespace();
     cDigest_Base = rb_path2class("Digest::Base");
 
-- 
cgit v0.10.2


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

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