1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* struct.c (rb_struct_init_copy): disallow changing the size.

[ruby-dev:31168]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-07-12 08:03:18 +00:00
parent d7e32900cc
commit 420a5fe48e
3 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,8 @@
Thu Jul 12 17:03:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* struct.c (rb_struct_init_copy): disallow changing the size.
[ruby-dev:31168]
Wed Jul 11 23:38:14 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* random.c: documentation fix. srand(0) initializes PRNG with '0',

View file

@ -252,7 +252,7 @@ rb_struct_define(name, va_alist)
ary = rb_ary_new();
va_init_list(ar, name);
while (mem = va_arg(ar, char*)) {
while ((mem = va_arg(ar, char*)) != 0) {
ID slot = rb_intern(mem);
rb_ary_push(ary, ID2SYM(slot));
}
@ -557,8 +557,9 @@ rb_struct_init_copy(copy, s)
if (!rb_obj_is_instance_of(s, rb_obj_class(copy))) {
rb_raise(rb_eTypeError, "wrong argument class");
}
RSTRUCT(copy)->ptr = ALLOC_N(VALUE, RSTRUCT(s)->len);
RSTRUCT(copy)->len = RSTRUCT(s)->len;
if (RSTRUCT(copy)->len != RSTRUCT(s)->len) {
rb_raise(rb_eTypeError, "struct size mismatch");
}
MEMCPY(RSTRUCT(copy)->ptr, RSTRUCT(s)->ptr, VALUE, RSTRUCT(copy)->len);
return copy;

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.6"
#define RUBY_RELEASE_DATE "2007-07-10"
#define RUBY_RELEASE_DATE "2007-07-12"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20070710
#define RUBY_RELEASE_CODE 20070712
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 7
#define RUBY_RELEASE_DAY 10
#define RUBY_RELEASE_DAY 12
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];