summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2006-01-19 18:37:30 +0000
committerjasone <jasone@FreeBSD.org>2006-01-19 18:37:30 +0000
commit0d0573f36bbe56976507162aeed34a622fbed6bc (patch)
treee98ec63db8e8e270780b9f21da05eaf9dc434f63
parenteb47c80ff850d5fa4af745f12d37b8b47b3892d4 (diff)
downloadFreeBSD-src-0d0573f36bbe56976507162aeed34a622fbed6bc.zip
FreeBSD-src-0d0573f36bbe56976507162aeed34a622fbed6bc.tar.gz
Remove loops in arena_coalesce(). They are no longer necessary, now that
internal allocation does not rely on recursive arena use (base_arena was removed in revision 1.95).
-rw-r--r--lib/libc/stdlib/malloc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 75edd2f..3249730 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1789,7 +1789,7 @@ arena_coalesce(arena_t *arena, region_t **reg, size_t size)
assert(region_prev_free_get(&next->sep));
assert(region_next_size_get(&treg->sep) == next->prev.size);
- while (region_prev_free_get(&treg->sep)) {
+ if (region_prev_free_get(&treg->sep)) {
prev_size = treg->prev.size;
prev = (region_t *)&((char *)treg)[-prev_size];
assert(region_next_free_get(&prev->sep));
@@ -1801,13 +1801,13 @@ arena_coalesce(arena_t *arena, region_t **reg, size_t size)
treg = prev;
#ifdef MALLOC_STATS
- if (ret == false)
- arena->stats.ncoalesce++;
+ arena->stats.ncoalesce++;
#endif
ret = true;
}
+ assert(region_prev_free_get(&treg->sep) == false);
- while (region_next_free_get(&next->sep)) {
+ if (region_next_free_get(&next->sep)) {
next_size = region_next_size_get(&next->sep);
nextnext = (region_t *)&((char *)next)[next_size];
assert(region_prev_free_get(&nextnext->sep));
@@ -1828,6 +1828,7 @@ arena_coalesce(arena_t *arena, region_t **reg, size_t size)
next = (region_t *)&((char *)treg)[tsize];
}
+ assert(region_next_free_get(&next->sep) == false);
/* Update header/footer. */
if (ret) {
OpenPOWER on IntegriCloud