prevented HeapMmgr::allocMem() and HeapMmgr::reallocMem() from thrown an exception

This commit is contained in:
2018-07-01 07:59:06 +00:00
parent 9ff9cb1d55
commit 1a102644ed
5 changed files with 17 additions and 21 deletions

View File

@ -55,32 +55,28 @@ void* HeapMmgr::allocMem (qse_size_t n) QSE_CPP_NOEXCEPT
{
if (!this->xma)
{
this->xma = qse_xma_open (this->getMmgr(), QSE_SIZEOF(xma_xtn_t), heap_size);
this->xma = qse_xma_open(this->getMmgr(), QSE_SIZEOF(xma_xtn_t), heap_size);
if (!this->xma) return QSE_NULL;
xma_xtn_t* xtn = (xma_xtn_t*)qse_xma_getxtn (this->xma);
xma_xtn_t* xtn = (xma_xtn_t*)qse_xma_getxtn(this->xma);
xtn->heap = this;
}
void* xptr = qse_xma_alloc (this->xma, n);
if (!xptr) QSE_THROW (MemoryError);
return xptr;
return qse_xma_alloc(this->xma, n);
}
void* HeapMmgr::reallocMem (void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT
{
if (!this->xma)
{
this->xma = qse_xma_open (this->getMmgr(), QSE_SIZEOF(xma_xtn_t), heap_size);
this->xma = qse_xma_open(this->getMmgr(), QSE_SIZEOF(xma_xtn_t), heap_size);
if (!this->xma) return QSE_NULL;
xma_xtn_t* xtn = (xma_xtn_t*)qse_xma_getxtn (this->xma);
xma_xtn_t* xtn = (xma_xtn_t*)qse_xma_getxtn(this->xma);
xtn->heap = this;
}
void* xptr = qse_xma_realloc (this->xma, ptr, n);
if (!xptr) QSE_THROW (MemoryError);
return xptr;
return qse_xma_realloc(this->xma, ptr, n);
}
void HeapMmgr::freeMem (void* ptr) QSE_CPP_NOEXCEPT