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

ruby-changes:64270

From: Yusuke <ko1@a...>
Date: Fri, 18 Dec 2020 16:09:32 +0900 (JST)
Subject: [ruby-changes:64270] 41c208d4a4 (master): Revert "Use rb_id_attrset without intermediate strings"

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

From 41c208d4a463183fddca250026e5f1cd759d2604 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Fri, 18 Dec 2020 14:12:38 +0900
Subject: Revert "Use rb_id_attrset without intermediate strings"

This reverts commit 66090b9d10cdaed917b525225e59d1c19e399248.

diff --git a/object.c b/object.c
index 301c77e..4fe6b02 100644
--- a/object.c
+++ b/object.c
@@ -2332,7 +2332,7 @@ rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/object.c#L2332
     for (i=0; i<argc; i++) {
 	ID id = id_for_attr(klass, argv[i]);
 	rb_attr(klass, id, FALSE, TRUE, TRUE);
-	rb_ary_push(names, ID2SYM(rb_id_attrset(id)));
+	rb_ary_push(names, rb_str_intern(rb_sprintf("%"PRIsVALUE"=", ID2SYM(id))));
     }
     return names;
 }
@@ -2363,10 +2363,11 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/object.c#L2363
 
     for (i=0; i<argc; i++) {
 	ID id = id_for_attr(klass, argv[i]);
+	VALUE idv = ID2SYM(id);
 
 	rb_attr(klass, id, TRUE, TRUE, TRUE);
-	rb_ary_push(names, ID2SYM(id));
-	rb_ary_push(names, ID2SYM(rb_id_attrset(id)));
+	rb_ary_push(names, idv);
+	rb_ary_push(names, rb_str_intern(rb_sprintf("%"PRIsVALUE"=", idv)));
     }
     return names;
 }
-- 
cgit v0.10.2


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

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