Refactor arena_ralloc_no_move().
Refactor early return logic in arena_ralloc_no_move() to return early on failure rather than on success.
This commit is contained in:
parent
578cd16581
commit
4985dc681e
19
src/arena.c
19
src/arena.c
@ -2810,20 +2810,19 @@ arena_ralloc_no_move(void *ptr, size_t oldsize, size_t size, size_t extra,
|
|||||||
if (oldsize <= SMALL_MAXCLASS) {
|
if (oldsize <= SMALL_MAXCLASS) {
|
||||||
assert(arena_bin_info[size2index(oldsize)].reg_size ==
|
assert(arena_bin_info[size2index(oldsize)].reg_size ==
|
||||||
oldsize);
|
oldsize);
|
||||||
if ((usize_max <= SMALL_MAXCLASS &&
|
if ((usize_max > SMALL_MAXCLASS ||
|
||||||
size2index(usize_max) == size2index(oldsize)) ||
|
size2index(usize_max) != size2index(oldsize)) &&
|
||||||
(size <= oldsize && usize_max >= oldsize))
|
(size > oldsize || usize_max < oldsize))
|
||||||
return (false);
|
return (true);
|
||||||
} else {
|
} else {
|
||||||
if (usize_max > SMALL_MAXCLASS) {
|
if (usize_max <= SMALL_MAXCLASS)
|
||||||
if (!arena_ralloc_large(ptr, oldsize, usize_min,
|
return (true);
|
||||||
|
if (arena_ralloc_large(ptr, oldsize, usize_min,
|
||||||
usize_max, zero))
|
usize_max, zero))
|
||||||
return (false);
|
return (true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reallocation would require a move. */
|
return (false);
|
||||||
return (true);
|
|
||||||
} else {
|
} else {
|
||||||
return (huge_ralloc_no_move(ptr, oldsize, usize_min, usize_max,
|
return (huge_ralloc_no_move(ptr, oldsize, usize_min, usize_max,
|
||||||
zero));
|
zero));
|
||||||
|
Loading…
Reference in New Issue
Block a user