This commit is contained in:
Jeremy Hylton 2006-02-28 18:29:00 +00:00
parent 14ca327f99
commit 08533fdad6

View file

@ -54,7 +54,8 @@ PyArenaList_FreeObject(PyArenaList *alist)
static block *
block_new(size_t size)
{
/* Allocate header and block as one unit. ab_mem points just past header. */
/* Allocate header and block as one unit.
ab_mem points just past header. */
block *b = (block *)malloc(sizeof(block) + size);
if (!b)
return NULL;
@ -80,11 +81,13 @@ block_alloc(block *b, size_t size)
void *p;
assert(b);
if (b->ab_offset + size > b->ab_size) {
/* If we need to allocate more memory than will fit in the default
block, allocate a one-off block that is exactly the right size. */
/* TODO(jhylton): Think more about space waste at end of block */
/* If we need to allocate more memory than will fit in
the default block, allocate a one-off block that is
exactly the right size. */
/* TODO(jhylton): Think about space waste at end of block */
block *new = block_new(
size < DEFAULT_BLOCK_SIZE ? DEFAULT_BLOCK_SIZE : size);
size < DEFAULT_BLOCK_SIZE ?
DEFAULT_BLOCK_SIZE : size);
if (!new)
return NULL;
assert(!b->ab_next);