mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Ntdll implements the user heaps. Don't try to handle this yourself.
svn path=/trunk/; revision=7847
This commit is contained in:
parent
c6651faa5f
commit
a27a41929d
1 changed files with 2 additions and 32 deletions
|
@ -1,31 +1,12 @@
|
|||
#include <windows.h>
|
||||
#include <kernel32/heap.h>
|
||||
#include <msvcrt/malloc.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
void* _expand(void* pold, size_t size)
|
||||
{
|
||||
PHEAP_BUCKET pbucket;
|
||||
PHEAP_SUBALLOC psub;
|
||||
PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE);
|
||||
|
||||
/* sanity checks */
|
||||
if (pfrag->Magic != HEAP_FRAG_MAGIC)
|
||||
return NULL;
|
||||
|
||||
/* get bucket size */
|
||||
psub = pfrag->Sub;
|
||||
pbucket = psub->Bucket;
|
||||
if(size <= pbucket->Size) {
|
||||
pfrag->Size=size;
|
||||
return pold;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, pold, size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -33,16 +14,5 @@ void* _expand(void* pold, size_t size)
|
|||
*/
|
||||
size_t _msize(void* pBlock)
|
||||
{
|
||||
PHEAP_BUCKET pbucket;
|
||||
PHEAP_SUBALLOC psub;
|
||||
PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pBlock-HEAP_FRAG_ADMIN_SIZE);
|
||||
|
||||
/* sanity checks */
|
||||
if (pfrag->Magic != HEAP_FRAG_MAGIC)
|
||||
return 0;
|
||||
|
||||
/* get bucket size */
|
||||
psub = pfrag->Sub;
|
||||
pbucket = psub->Bucket;
|
||||
return pbucket->Size;
|
||||
return HeapSize (GetProcessHeap(), 0, pBlock);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue