mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Tabify
This commit is contained in:
parent
14ca327f99
commit
08533fdad6
1 changed files with 85 additions and 82 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue