diff options
author | Jemma Issroff <[email protected]> | 2022-10-21 16:24:29 -0400 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2022-10-21 14:57:34 -0700 |
commit | a11952dac1a5b0776a493968eeffbd4be4403b76 (patch) | |
tree | b905121c4e4ac94010def14957da6539ce0dd2d5 /variable.c | |
parent | 13bd617ea6fdf72467c593639cf33312a06c330c (diff) |
Rename `iv_count` on shapes to `next_iv_index`
`iv_count` is a misleading name because when IVs are unset, the new
shape doesn't decrement this value. `next_iv_count` is an accurate, and
more descriptive name.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6608
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/variable.c b/variable.c index d83b8487a7..d41ea75214 100644 --- a/variable.c +++ b/variable.c @@ -1018,7 +1018,7 @@ generic_ivar_update(st_data_t *k, st_data_t *v, st_data_t u, int existing) } } FL_SET((VALUE)*k, FL_EXIVAR); - ivtbl = gen_ivtbl_resize(ivtbl, ivup->shape->iv_count); + ivtbl = gen_ivtbl_resize(ivtbl, ivup->shape->next_iv_index); // Reinsert in to the hash table because ivtbl might be a newly resized chunk of memory *v = (st_data_t)ivtbl; ivup->ivtbl = ivtbl; @@ -1435,7 +1435,7 @@ rb_ensure_generic_iv_list_size(VALUE obj, uint32_t newsize) void rb_init_iv_list(VALUE obj) { - uint32_t newsize = (uint32_t)(rb_shape_get_shape(obj)->iv_count * 2.0); + uint32_t newsize = (uint32_t)(rb_shape_get_shape(obj)->next_iv_index * 2.0); uint32_t len = ROBJECT_NUMIV(obj); rb_ensure_iv_list_size(obj, len, newsize < len ? len : newsize); } @@ -1450,7 +1450,7 @@ obj_ivar_set(VALUE obj, ID id, VALUE val) if (!rb_shape_get_iv_index(shape, id, &index)) { shape = rb_shape_get_next(shape, obj, id); - index = shape->iv_count - 1; + index = shape->next_iv_index - 1; } uint32_t len = ROBJECT_NUMIV(obj); @@ -1615,7 +1615,7 @@ iterate_over_shapes_with_callback(rb_shape_t *shape, VALUE* iv_list, rb_ivar_for return; case SHAPE_IVAR: iterate_over_shapes_with_callback(rb_shape_get_shape_by_id(shape->parent_id), iv_list, callback, arg); - VALUE val = iv_list[shape->iv_count - 1]; + VALUE val = iv_list[shape->next_iv_index - 1]; if (val != Qundef) { callback(shape->edge_name, val, arg); } @@ -1753,7 +1753,7 @@ rb_ivar_count(VALUE obj) switch (BUILTIN_TYPE(obj)) { case T_OBJECT: - if (rb_shape_get_shape(obj)->iv_count > 0) { + if (rb_shape_get_shape(obj)->next_iv_index > 0) { st_index_t i, count, num = ROBJECT_IV_COUNT(obj); const VALUE *const ivptr = ROBJECT_IVPTR(obj); for (i = count = 0; i < num; ++i) { |