зеркало из https://github.com/github/ruby.git
refactoring.
iv_index_tbl_newsize() usually returns iv_index_tbl->num_entries because ivup->iv_extended is usually false.
This commit is contained in:
Родитель
2fed5f0ad8
Коммит
b557c5768c
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче