summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-06-04 13:35:43 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-06-05 22:06:15 +0200
commit4e39580992064a4e91e9b8626a1a220f262a7011 (patch)
tree283baa3f6d9bdac213a6f6b44a12580d7a2f6b84 /variable.c
parent0b07d2a1e32a456fc302c8d970fa85782bdb98ce (diff)
Refactor raw accesses to rb_shape_t.capacity
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13524
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/variable.c b/variable.c
index bdf18b8e4f..0d01a349bc 100644
--- a/variable.c
+++ b/variable.c
@@ -1825,13 +1825,13 @@ generic_fields_lookup_ensure_size(st_data_t *k, st_data_t *v, st_data_t u, int e
if (!existing || fields_lookup->resize) {
if (existing) {
RUBY_ASSERT(RSHAPE(fields_lookup->shape_id)->type == SHAPE_IVAR || RSHAPE(fields_lookup->shape_id)->type == SHAPE_OBJ_ID);
- RUBY_ASSERT(RSHAPE(RSHAPE(fields_lookup->shape_id)->parent_id)->capacity < RSHAPE(fields_lookup->shape_id)->capacity);
+ RUBY_ASSERT(RSHAPE_CAPACITY(RSHAPE(fields_lookup->shape_id)->parent_id) < RSHAPE_CAPACITY(fields_lookup->shape_id));
}
else {
FL_SET_RAW((VALUE)*k, FL_EXIVAR);
}
- fields_tbl = gen_fields_tbl_resize(fields_tbl, RSHAPE(fields_lookup->shape_id)->capacity);
+ fields_tbl = gen_fields_tbl_resize(fields_tbl, RSHAPE_CAPACITY(fields_lookup->shape_id));
*v = (st_data_t)fields_tbl;
}
@@ -1940,14 +1940,14 @@ generic_field_set(VALUE obj, shape_id_t target_shape_id, VALUE val)
}
void
-rb_ensure_iv_list_size(VALUE obj, uint32_t current_capacity, uint32_t new_capacity)
+rb_ensure_iv_list_size(VALUE obj, uint32_t current_len, uint32_t new_capacity)
{
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
if (RBASIC(obj)->flags & ROBJECT_EMBED) {
VALUE *ptr = ROBJECT_FIELDS(obj);
VALUE *newptr = ALLOC_N(VALUE, new_capacity);
- MEMCPY(newptr, ptr, VALUE, current_capacity);
+ MEMCPY(newptr, ptr, VALUE, current_len);
RB_FL_UNSET_RAW(obj, ROBJECT_EMBED);
ROBJECT(obj)->as.heap.fields = newptr;
}
@@ -2370,13 +2370,13 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
}
}
- if (!RSHAPE(dest_shape_id)->capacity) {
+ if (!RSHAPE_LEN(dest_shape_id)) {
rb_obj_set_shape_id(dest, dest_shape_id);
FL_UNSET(dest, FL_EXIVAR);
return;
}
- new_fields_tbl = gen_fields_tbl_resize(0, RSHAPE(dest_shape_id)->capacity);
+ new_fields_tbl = gen_fields_tbl_resize(0, RSHAPE_CAPACITY(dest_shape_id));
VALUE *src_buf = obj_fields_tbl->as.shape.fields;
VALUE *dest_buf = new_fields_tbl->as.shape.fields;