summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/struct.c b/struct.c
index 0dd5aba0a0..0e2b26f8fc 100644
--- a/struct.c
+++ b/struct.c
@@ -307,19 +307,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; i<RARRAY(rest)->len; 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);