summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 08:34:45 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 08:34:45 +0000
commit15f641a5f5c700603b81042bd39822b9b8c6296f (patch)
tree2fd7a72f5ab5bfc2007f4e0c7e997ef7709978c9 /struct.c
parent55c5054c031cf0a5cb6a86fac5e0dca6f2e0faaa (diff)
merge revision(s) 61616: [Backport #14314]
marshal.c: allow marshalling keyword_init struct struct.c: define rb_struct_s_keyword_init to shared with marshal.c internal.h: add the declaration to be used by marshal.c test/ruby/test_marshal.rb: add test for Bug#14314 [Feature #14314] [ruby-core:84629] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/struct.c b/struct.c
index 654e8670fa..cf28fec6fd 100644
--- a/struct.c
+++ b/struct.c
@@ -48,6 +48,12 @@ struct_ivar_get(VALUE c, ID id)
}
VALUE
+rb_struct_s_keyword_init(VALUE klass)
+{
+ return struct_ivar_get(klass, id_keyword_init);
+}
+
+VALUE
rb_struct_s_members(VALUE klass)
{
VALUE members = struct_ivar_get(klass, id_members);
@@ -298,7 +304,7 @@ static VALUE
rb_struct_s_inspect(VALUE klass)
{
VALUE inspect = rb_class_name(klass);
- if (RTEST(struct_ivar_get(klass, id_keyword_init))) {
+ if (RTEST(rb_struct_s_keyword_init(klass))) {
rb_str_cat_cstr(inspect, "(keyword_init: true)");
}
return inspect;
@@ -616,7 +622,7 @@ rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
rb_struct_modify(self);
n = num_members(klass);
- if (argc > 0 && RTEST(struct_ivar_get(klass, id_keyword_init))) {
+ if (argc > 0 && RTEST(rb_struct_s_keyword_init(klass))) {
struct struct_hash_set_arg arg;
if (argc > 2 || !RB_TYPE_P(argv[0], T_HASH)) {
rb_raise(rb_eArgError, "wrong number of arguments (given %d, expected 0)", argc);