diff --git a/ChangeLog b/ChangeLog index 3f1548206e..3008fba22e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Jun 2 00:02:16 2005 Minero Aoki + + * struct.c: accessing >10 member caused segmentation fault. + [ruby-dev:26247] + + * test/ruby/test_struct.rb: test it. + Wed Jun 1 11:30:09 2005 Hirokazu Yamamoto * bcc32/Makefile.sub: can use single quote character in DESTDIR. diff --git a/struct.c b/struct.c index f0458a3520..17fc72b1e0 100644 --- a/struct.c +++ b/struct.c @@ -132,7 +132,9 @@ static VALUE rb_struct_ref7(obj) VALUE obj; {return RSTRUCT(obj)->ptr[7];} static VALUE rb_struct_ref8(obj) VALUE obj; {return RSTRUCT(obj)->ptr[8];} static VALUE rb_struct_ref9(obj) VALUE obj; {return RSTRUCT(obj)->ptr[9];} -static VALUE (*ref_func[10])() = { +#define N_REF_FUNC (sizeof(ref_func) / sizeof(VALUE (*)())) + +static VALUE (*ref_func[])() = { rb_struct_ref0, rb_struct_ref1, rb_struct_ref2, @@ -211,7 +213,7 @@ make_struct(name, members, klass) for (i=0; i< RARRAY(members)->len; i++) { ID id = SYM2ID(RARRAY(members)->ptr[i]); if (rb_is_local_id(id) || rb_is_const_id(id)) { - if (i