ruby-changes:13479
From: nobu <ko1@a...>
Date: Wed, 7 Oct 2009 16:06:49 +0900 (JST)
Subject: [ruby-changes:13479] Ruby:r25255 (trunk): * include/ruby/ruby.h (rb_long2int): evalates the argument only
nobu 2009-10-07 16:06:32 +0900 (Wed, 07 Oct 2009) New Revision: 25255 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25255 Log: * include/ruby/ruby.h (rb_long2int): evalates the argument only once. * struct.c (rb_struct_alloc): check array length overflow. Modified files: trunk/ChangeLog trunk/include/ruby/ruby.h trunk/struct.c Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 25254) +++ include/ruby/ruby.h (revision 25255) @@ -653,7 +653,7 @@ int i = (int)(n); \ if ((long)i != (n)) rb_out_of_int(n) #ifdef __GNUC__ -#define rb_long2int(i2l_n) __extension__ ({rb_long2int_internal(i2l_n, i2l_i); i2l_i;}) +#define rb_long2int(n) __extension__ ({long i2l_n = (n); rb_long2int_internal(i2l_n, i2l_i); i2l_i;}) #else static inline int rb_long2int(long n) {rb_long2int_internal(n, i); return i;} Index: ChangeLog =================================================================== --- ChangeLog (revision 25254) +++ ChangeLog (revision 25255) @@ -1,3 +1,10 @@ +Wed Oct 7 16:06:30 2009 Nobuyoshi Nakada <nobu@r...> + + * include/ruby/ruby.h (rb_long2int): evalates the argument only + once. + + * struct.c (rb_struct_alloc): check array length overflow. + Wed Oct 7 09:23:49 2009 NARUSE, Yui <naruse@r...> * string.c (rb_str_inspect): don't assign -1 to unsigned int. Index: struct.c =================================================================== --- struct.c (revision 25254) +++ struct.c (revision 25255) @@ -415,7 +415,7 @@ VALUE rb_struct_alloc(VALUE klass, VALUE values) { - return rb_class_new_instance(RARRAY_LEN(values), RARRAY_PTR(values), klass); + return rb_class_new_instance(RARRAY_LENINT(values), RARRAY_PTR(values), klass); } VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/