Commit b20f4666 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

ntdll: Rename local variables in heap_allocate.

parent a3acd635
...@@ -1536,17 +1536,16 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap ) ...@@ -1536,17 +1536,16 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap )
static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret ) static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret )
{ {
ARENA_FREE *pArena; struct block *block;
ARENA_INUSE *pInUse; struct entry *entry;
SIZE_T data_size;
SUBHEAP *subheap; SUBHEAP *subheap;
SIZE_T rounded_size;
rounded_size = ROUND_SIZE(size) + HEAP_TAIL_EXTRA_SIZE( flags );
if (rounded_size < size) return STATUS_NO_MEMORY; /* overflow */ data_size = ROUND_SIZE(size) + HEAP_TAIL_EXTRA_SIZE(flags);
if (rounded_size < HEAP_MIN_DATA_SIZE) rounded_size = HEAP_MIN_DATA_SIZE; if (data_size < size) return STATUS_NO_MEMORY; /* overflow */
if (data_size < HEAP_MIN_DATA_SIZE) data_size = HEAP_MIN_DATA_SIZE;
if (rounded_size >= HEAP_MIN_LARGE_BLOCK_SIZE) if (data_size >= HEAP_MIN_LARGE_BLOCK_SIZE)
{ {
if (!(*ret = allocate_large_block( heap, flags, size ))) return STATUS_NO_MEMORY; if (!(*ret = allocate_large_block( heap, flags, size ))) return STATUS_NO_MEMORY;
return STATUS_SUCCESS; return STATUS_SUCCESS;
...@@ -1554,29 +1553,29 @@ static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret ...@@ -1554,29 +1553,29 @@ static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret
/* Locate a suitable free block */ /* Locate a suitable free block */
if (!(pArena = HEAP_FindFreeBlock( heap, rounded_size, &subheap ))) return STATUS_NO_MEMORY; if (!(entry = HEAP_FindFreeBlock( heap, data_size, &subheap ))) return STATUS_NO_MEMORY;
/* Remove the arena from the free list */ /* Remove the arena from the free list */
list_remove( &pArena->entry ); list_remove( &entry->entry );
/* Build the in-use arena */ /* Build the in-use arena */
pInUse = (ARENA_INUSE *)pArena; block = (struct block *)entry;
/* in-use arena is smaller than free arena, /* in-use arena is smaller than free arena,
* so we have to add the difference to the size */ * so we have to add the difference to the size */
pInUse->size = (pInUse->size & ~ARENA_FLAG_FREE) + sizeof(ARENA_FREE) - sizeof(ARENA_INUSE); block->size = (block->size & ~ARENA_FLAG_FREE) + sizeof(*entry) - sizeof(*block);
pInUse->magic = ARENA_INUSE_MAGIC; block->magic = ARENA_INUSE_MAGIC;
/* Shrink the block */ /* Shrink the block */
shrink_used_block( subheap, pInUse, rounded_size, size ); shrink_used_block( subheap, block, data_size, size );
notify_alloc( pInUse + 1, size, flags & HEAP_ZERO_MEMORY ); notify_alloc( block + 1, size, flags & HEAP_ZERO_MEMORY );
initialize_block( pInUse + 1, size, pInUse->unused_bytes, flags ); initialize_block( block + 1, size, block->unused_bytes, flags );
*ret = pInUse + 1; *ret = block + 1;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment