method
initialize_copy
v1_8_7_72 -
Show latest stable
- Class:
Struct
initialize_copy(p1)public
No documentation available.
/* :nodoc: */
static VALUE
rb_struct_init_copy(copy, s)
VALUE copy, 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 (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;
}