Skip to content

Commit b0f876a

Browse files
committed
Implement copy_to, get rid of repr_clone.
1 parent f4f9287 commit b0f876a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/6model/reprs/P6bigint.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
4949
mp_zero(&body->i);
5050
}
5151

52+
/* Copies to the body of one object to another. */
53+
static void copy_to(PARROT_INTERP, STable *st, void *src, void *dest) {
54+
P6bigintBody *src_body = (P6bigintBody *)src;
55+
P6bigintBody *dest_body = (P6bigintBody *)dest;
56+
mp_init_copy(&src_body->i, &dest_body->i);
57+
}
58+
5259
/* Helper to die because this type doesn't support attributes. */
5360
PARROT_DOES_NOT_RETURN
5461
static void die_no_attrs(PARROT_INTERP) {
@@ -77,14 +84,6 @@ static INTVAL hint_for(PARROT_INTERP, STable *st, PMC *class_handle, STRING *nam
7784
return NO_HINT;
7885
}
7986

80-
/* Clones the current object; simply copies the value. */
81-
static PMC * repr_clone(PARROT_INTERP, PMC *to_clone) {
82-
P6bigintInstance *obj = mem_allocate_zeroed_typed(P6bigintInstance);
83-
obj->common.stable = STABLE_PMC(to_clone);
84-
mp_init_copy(&obj->i, &((P6bigintInstance *)PMC_data(to_clone))->i);
85-
return wrap_object_func(interp, obj);
86-
}
87-
8887
/* Used with boxing. Sets an integer value, for representations that can hold
8988
* one. */
9089
static void set_int(PARROT_INTERP, PMC *obj, INTVAL value) {
@@ -184,12 +183,12 @@ REPROps * P6bigint_initialize(PARROT_INTERP,
184183
this_repr->type_object_for = type_object_for;
185184
this_repr->allocate = allocate;
186185
this_repr->initialize = initialize;
186+
this_repr->copy_to = copy_to;
187187
this_repr->get_attribute_boxed = get_attribute_boxed;
188188
this_repr->get_attribute_boxed = get_attribute_boxed;
189189
this_repr->bind_attribute_boxed = bind_attribute_boxed;
190190
this_repr->bind_attribute_ref = bind_attribute_ref;
191191
this_repr->hint_for = hint_for;
192-
this_repr->clone = repr_clone;
193192
this_repr->set_int = set_int;
194193
this_repr->get_int = get_int;
195194
this_repr->set_num = set_num;

0 commit comments

Comments
 (0)