aboutsummaryrefslogtreecommitdiff
path: root/src/falloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/falloc.c')
-rw-r--r--src/falloc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/falloc.c b/src/falloc.c
index 6571d9b..2fb8ea1 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -424,15 +424,26 @@ _gdbm_put_av_elem (avail_elem new_el, avail_elem av_table[], int *av_count,
/* Not contiguous */
else
{
index++;
continue;
}
-
- /* If we got here, we're done. */
- return TRUE;
+
+ /* Coalescing breaks the sorting order, so we need to
+ restore it */
+ while (index + 1 < *av_count
+ && av_table[index].av_size > av_table[index + 1].av_size)
+ {
+ avail_elem t = av_table[index];
+ av_table[index] = av_table[index + 1];
+ av_table[index + 1] = t;
+ index++;
+ }
+
+ /* we're done. */
+ return TRUE;
}
}
/* Search for place to put element. List is sorted by size. */
index = 0;
while (index < *av_count && av_table[index].av_size < new_el.av_size)

Return to:

Send suggestions and report system problems to the System administrator.