From 8480bcc8d5c72b61055cfa98e80f37fd62ae7ad4 Mon Sep 17 00:00:00 2001 From: knu Date: Sun, 18 May 2008 15:02:36 +0000 Subject: Merge -r16241:16456 from ruby_1_8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- struct.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 73017d1210..8a3f8acb5c 100644 --- a/struct.c +++ b/struct.c @@ -310,19 +310,14 @@ rb_struct_s_def(argc, argv, klass) ID id; rb_scan_args(argc, argv, "1*", &name, &rest); + if (!NIL_P(name) && SYMBOL_P(name)) { + rb_ary_unshift(rest, name); + name = Qnil; + } for (i=0; ilen; i++) { id = rb_to_id(RARRAY(rest)->ptr[i]); RARRAY(rest)->ptr[i] = ID2SYM(id); } - if (!NIL_P(name)) { - VALUE tmp = rb_check_string_type(name); - - if (NIL_P(tmp)) { - id = rb_to_id(name); - rb_ary_unshift(rest, ID2SYM(id)); - name = Qnil; - } - } st = make_struct(name, rest, klass); if (rb_block_given_p()) { rb_mod_module_eval(0, 0, st); -- cgit v1.2.1