proc.c: saves Binding#clone on copying ivars twice
This commit is contained in:
parent
5ac435dc34
commit
0cc41d3d39
Notes:
git
2025-06-06 09:30:36 +00:00
16
proc.c
16
proc.c
@ -298,10 +298,8 @@ rb_binding_alloc(VALUE klass)
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* :nodoc: */
|
|
||||||
static VALUE
|
static VALUE
|
||||||
binding_dup(VALUE self)
|
binding_copy(VALUE self)
|
||||||
{
|
{
|
||||||
VALUE bindval = rb_binding_alloc(rb_cBinding);
|
VALUE bindval = rb_binding_alloc(rb_cBinding);
|
||||||
rb_binding_t *src, *dst;
|
rb_binding_t *src, *dst;
|
||||||
@ -310,15 +308,21 @@ binding_dup(VALUE self)
|
|||||||
rb_vm_block_copy(bindval, &dst->block, &src->block);
|
rb_vm_block_copy(bindval, &dst->block, &src->block);
|
||||||
RB_OBJ_WRITE(bindval, &dst->pathobj, src->pathobj);
|
RB_OBJ_WRITE(bindval, &dst->pathobj, src->pathobj);
|
||||||
dst->first_lineno = src->first_lineno;
|
dst->first_lineno = src->first_lineno;
|
||||||
return rb_obj_dup_setup(self, bindval);
|
return bindval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* :nodoc: */
|
||||||
|
static VALUE
|
||||||
|
binding_dup(VALUE self)
|
||||||
|
{
|
||||||
|
return rb_obj_dup_setup(self, binding_copy(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* :nodoc: */
|
/* :nodoc: */
|
||||||
static VALUE
|
static VALUE
|
||||||
binding_clone(VALUE self)
|
binding_clone(VALUE self)
|
||||||
{
|
{
|
||||||
VALUE bindval = binding_dup(self);
|
return rb_obj_clone_setup(self, binding_copy(self), Qnil);
|
||||||
return rb_obj_clone_setup(self, bindval, Qnil);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user