Skip to content

Commit 477b1e7

Browse files
committed
Directly use rb_imemo_new in imemo_fields_new_complex
We should not assume that a complex imemo_field takes only one additional VALUE space. This is fragile as it will break if we add additional fields to complex imemo_field.
1 parent bb25ed6 commit 477b1e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

imemo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ rb_imemo_fields_new(VALUE owner, size_t capa)
123123
static VALUE
124124
imemo_fields_new_complex(VALUE owner, size_t capa)
125125
{
126-
VALUE fields = imemo_fields_new(owner, 1);
126+
VALUE fields = rb_imemo_new(imemo_fields, owner, sizeof(struct rb_fields));
127127
IMEMO_OBJ_FIELDS(fields)->as.complex.table = st_init_numtable_with_size(capa);
128128
FL_SET_RAW(fields, OBJ_FIELD_HEAP);
129129
return fields;

0 commit comments

Comments
 (0)