ruby-changes:28218
From: nobu <ko1@a...>
Date: Sat, 13 Apr 2013 10:20:48 +0900 (JST)
Subject: [ruby-changes:28218] nobu:r40270 (trunk): struct.c: hide member names
nobu 2013-04-13 10:20:39 +0900 (Sat, 13 Apr 2013) New Revision: 40270 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40270 Log: struct.c: hide member names * struct.c (rb_struct_define_without_accessor, rb_struct_define), (rb_struct_s_def): hide member names array. Modified files: trunk/ChangeLog trunk/struct.c Index: ChangeLog =================================================================== --- ChangeLog (revision 40269) +++ ChangeLog (revision 40270) @@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Sat Apr 13 10:20:32 2013 Nobuyoshi Nakada <nobu@r...> +Sat Apr 13 10:20:37 2013 Nobuyoshi Nakada <nobu@r...> + + * struct.c (rb_struct_define_without_accessor, rb_struct_define), + (rb_struct_s_def): hide member names array. * struct.c (anonymous_struct, new_struct, setup_struct): split make_struct() for each purpose. Index: struct.c =================================================================== --- struct.c (revision 40269) +++ struct.c (revision 40270) @@ -243,7 +243,7 @@ rb_struct_define_without_accessor(const https://github.com/ruby/ruby/blob/trunk/struct.c#L243 VALUE members; char *name; - members = rb_ary_new2(0); + members = rb_ary_tmp_new(0); va_start(ar, alloc); while ((name = va_arg(ar, char*)) != NULL) { rb_ary_push(members, ID2SYM(rb_intern(name))); @@ -275,7 +275,7 @@ rb_struct_define(const char *name, ...) https://github.com/ruby/ruby/blob/trunk/struct.c#L275 VALUE st, ary; char *mem; - ary = rb_ary_new(); + ary = rb_ary_tmp_new(0); va_start(ar, name); while ((mem = va_arg(ar, char*)) != 0) { @@ -351,7 +351,7 @@ rb_struct_s_def(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/struct.c#L351 --argc; ++argv; } - rest = rb_ary_new2(argc); + rest = rb_ary_tmp_new(argc); for (i=0; i<argc; i++) { id = rb_to_id(argv[i]); RARRAY_PTR(rest)[i] = ID2SYM(id); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/