diff options
Diffstat (limited to 'src/engine/shared/memheap.cpp')
| -rw-r--r-- | src/engine/shared/memheap.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/engine/shared/memheap.cpp b/src/engine/shared/memheap.cpp index 850577dd..c1c09eaf 100644 --- a/src/engine/shared/memheap.cpp +++ b/src/engine/shared/memheap.cpp @@ -10,7 +10,7 @@ void CHeap::NewChunk() { CChunk *pChunk; char *pMem; - + // allocate memory pMem = (char*)mem_alloc(sizeof(CChunk)+CHUNK_SIZE, 1); if(!pMem) @@ -25,14 +25,14 @@ void CHeap::NewChunk() pChunk->m_pNext = (CChunk *)0x0; pChunk->m_pNext = m_pCurrent; - m_pCurrent = pChunk; + m_pCurrent = pChunk; } //**************** void *CHeap::AllocateFromChunk(unsigned int Size) { char *pMem; - + // check if we need can fit the allocation if(m_pCurrent->m_pCurrent + Size > m_pCurrent->m_pEnd) return (void*)0x0; @@ -66,14 +66,14 @@ void CHeap::Clear() { CChunk *pChunk = m_pCurrent; CChunk *pNext; - + while(pChunk) { pNext = pChunk->m_pNext; mem_free(pChunk); pChunk = pNext; } - + m_pCurrent = 0x0; } @@ -88,10 +88,10 @@ void *CHeap::Allocate(unsigned Size) { // allocate new chunk and add it to the heap NewChunk(); - + // try to allocate again pMem = (char *)AllocateFromChunk(Size); } - + return pMem; } |