diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-27 08:31:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-27 08:31:08 +0000 |
commit | c45908e41f47c88674b73a754ecd0535449b667a (patch) | |
tree | a27bb0f2ca80fa80b9582ddcb8312eee673b0bd5 /struct.c | |
parent | cd3d4a01f248fad1a73ff0b66b7a8d1653f64c19 (diff) |
* file.c (rb_find_file): $LOAD_PATH must not be empty.
* file.c (rb_find_file_ext): ditto.
* range.c (range_eq): class check should be based on range.class,
instead of Range to work with Range.dup.
* range.c (range_eql): ditto.
* class.c (rb_mod_dup): need to preserve metaclass and flags.
* object.c (rb_cstr_to_dbl): had a buffer overrun.
* marshal.c (w_class): integrate singleton check into a funciton
to follow DRY principle.
* marshal.c (w_uclass): should check singleton method.
* object.c (rb_obj_dup): dmark and dfree functions must be match
for T_DATA type.
* object.c (rb_obj_dup): class of the duped object must be match
to the class of the original.
* re.c (rb_reg_quote): do not escape \t, \f, \r, \n, for they are
not regular expression metacharacters.
* time.c (time_s_alloc): use time_free instead of free (null check,
also serves for type mark).
* time.c (time_s_at): check dfree function too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -421,11 +421,12 @@ rb_struct_to_a(s) } static VALUE -rb_struct_clone(s) - VALUE s; +rb_struct_become(clone, s) + VALUE clone, s; { - VALUE clone = rb_obj_clone(s); - + if (!rb_obj_is_kind_of(s, rb_obj_class(clone))) { + rb_raise(rb_eTypeError, "wrong argument type"); + } RSTRUCT(clone)->ptr = ALLOC_N(VALUE, RSTRUCT(s)->len); RSTRUCT(clone)->len = RSTRUCT(s)->len; MEMCPY(RSTRUCT(clone)->ptr, RSTRUCT(s)->ptr, VALUE, RSTRUCT(clone)->len); @@ -589,7 +590,7 @@ Init_Struct() rb_define_singleton_method(rb_cStruct, "new", rb_struct_s_def, -1); rb_define_method(rb_cStruct, "initialize", rb_struct_initialize, -2); - rb_define_method(rb_cStruct, "clone", rb_struct_clone, 0); + rb_define_method(rb_cStruct, "become", rb_struct_become, 1); rb_define_method(rb_cStruct, "==", rb_struct_equal, 1); |