mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
refactoring.
iv_index_tbl_newsize() usually returns iv_index_tbl->num_entries because ivup->iv_extended is usually false.
This commit is contained in:
parent
2fed5f0ad8
commit
b557c5768c
1 changed files with 5 additions and 5 deletions
10
variable.c
10
variable.c
|
@ -1038,13 +1038,13 @@ gen_ivtbl_dup(const struct gen_ivtbl *orig)
|
|||
static uint32_t
|
||||
iv_index_tbl_newsize(struct ivar_update *ivup)
|
||||
{
|
||||
uint32_t index = (uint32_t)ivup->index; /* should not overflow */
|
||||
uint32_t newsize = (index+1) + (index+1)/4; /* (index+1)*1.25 */
|
||||
|
||||
if (!ivup->iv_extended) {
|
||||
newsize = (uint32_t)ivup->u.iv_index_tbl->num_entries;
|
||||
return (uint32_t)ivup->u.iv_index_tbl->num_entries;
|
||||
}
|
||||
else {
|
||||
uint32_t index = (uint32_t)ivup->index; /* should not overflow */
|
||||
return (index+1) + (index+1)/4; /* (index+1)*1.25 */
|
||||
}
|
||||
return newsize;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue