diff --git a/ChangeLog b/ChangeLog index c10fb5531b..d3008bbd18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon May 5 19:49:59 2008 Yukihiro Matsumoto + + * struct.c (rb_struct_s_def): Struct.new(0) should not SEGV. + based on the patch from wanabe in + [ruby-dev:34594]. + + * struct.c (make_struct): call to_str on name object. + Mon May 5 17:17:40 2008 Tanaka Akira * eval.c (ruby_cleanup): wrap ruby_finalize_0 by SAVE_ROOT_JMPBUF to diff --git a/struct.c b/struct.c index 74d20a426c..415032bed4 100644 --- a/struct.c +++ b/struct.c @@ -181,7 +181,9 @@ make_struct(VALUE name, VALUE members, VALUE klass) rb_class_inherited(klass, nstr); } else { - id = SYM2ID(rb_str_intern(name)); + /* old style: should we warn? */ + name = rb_str_to_str(name); + id = rb_to_id(name); if (!rb_is_const_id(id)) { rb_name_error(id, "identifier %s needs to be constant", StringValuePtr(name)); } @@ -322,14 +324,14 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass) ID id; rb_scan_args(argc, argv, "1*", &name, &rest); - for (i=0; i