mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 19:26:16 +00:00
Ntdll implements the user heaps. Don't try to handle this yourself.
svn path=/trunk/; revision=7847
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user