jerenkrantz 02/04/30 01:32:20
Modified: misc apr_rmm.c
Log:
- Remove MIN_BLK_SIZE bogosity. If the user wants to allocate small chunks,
the library must not get in the way even if *we* think it's silly. As
long as they have enough overhead allocated, we shouldn't get in the way.
- Fix bug in find_block_by_offset() that would return 0 instead of prev if
includes is set. This would prohibit coalescing from occuring on the
freelist if done in sequential order. Therefore, small allocs, freeing
those chunks, and a subsequent large alloc would fail.
Revision Changes Path
1.15 +2 -4 apr-util/misc/apr_rmm.c
Index: apr_rmm.c
===================================================================
RCS file: /home/cvs/apr-util/misc/apr_rmm.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- apr_rmm.c 30 Apr 2002 08:28:27 -0000 1.14
+++ apr_rmm.c 30 Apr 2002 08:32:20 -0000 1.15
@@ -79,8 +79,6 @@
apr_anylock_t lock;
};
-#define MIN_BLK_SIZE 128
-
static apr_rmm_off_t find_block_by_offset(apr_rmm_t *rmm, apr_rmm_off_t
next,
apr_rmm_off_t find, int includes)
{
@@ -99,7 +97,7 @@
prev = next;
next = blk->next;
}
- return 0;
+ return includes ? prev : 0;
}
static apr_rmm_off_t find_block_of_size(apr_rmm_t *rmm, apr_size_t size)
@@ -128,7 +126,7 @@
next = blk->next;
}
- if (bestsize - size > MIN_BLK_SIZE) {
+ if (bestsize - size > sizeof(struct rmm_block_t*)) {
struct rmm_block_t *blk = (rmm_block_t*)((char*)rmm->base + best);
struct rmm_block_t *new = (rmm_block_t*)((char*)rmm->base + best +
size);