1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use rb_id_attrset without intermediate strings

This commit is contained in:
Nobuyoshi Nakada 2020-12-18 12:10:20 +09:00
parent 5616f2ee93
commit 34f6b22df0
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -2306,7 +2306,7 @@ rb_mod_attr(int argc, VALUE *argv, VALUE klass)
rb_category_warning(RB_WARN_CATEGORY_DEPRECATED, "optional boolean argument is obsoleted");
rb_attr(klass, id, 1, RTEST(argv[1]), TRUE);
rb_ary_push(names, ID2SYM(id));
if (argv[1] == Qtrue) rb_ary_push(names, rb_str_intern(rb_sprintf("%"PRIsVALUE"=", ID2SYM(id))));
if (argv[1] == Qtrue) rb_ary_push(names, ID2SYM(rb_id_attrset(id)));
return names;
}
return rb_mod_attr_reader(argc, argv, klass);