summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/struct.c b/struct.c
index 8168f62bb1..91d562b97c 100644
--- a/struct.c
+++ b/struct.c
@@ -606,11 +606,7 @@ rb_struct_to_h(VALUE s)
VALUE
rb_struct_init_copy(VALUE copy, VALUE s)
{
- if (copy == s) return copy;
- rb_check_frozen(copy);
- if (!rb_obj_is_instance_of(s, rb_obj_class(copy))) {
- rb_raise(rb_eTypeError, "wrong argument class");
- }
+ if (!OBJ_INIT_COPY(copy, s)) return copy;
if (RSTRUCT_LEN(copy) != RSTRUCT_LEN(s)) {
rb_raise(rb_eTypeError, "struct size mismatch");
}