enhanced constructors of some Mmged classes.

added Mmged:setMmgr() and changed the accessibility of the member manager variable
This commit is contained in:
2015-03-11 01:47:26 +00:00
parent 23b718f366
commit 3793785e7c
19 changed files with 135 additions and 71 deletions

View File

@ -33,8 +33,15 @@ QSE_BEGIN_NAMESPACE(QSE)
Mmged::Mmged (Mmgr* mmgr)
{
if (!mmgr) mmgr = Mmgr::getDFL();
this->mmgr = mmgr;
this->_mmgr = mmgr;
}
void Mmged::setMmgr (Mmgr* mmgr)
{
if (!mmgr) mmgr = Mmgr::getDFL();
this->_mmgr = mmgr;
}
/////////////////////////////////
QSE_END_NAMESPACE(QSE)
/////////////////////////////////

View File

@ -87,7 +87,7 @@ void Mpool::dispose ()
Block* next = block->next;
//::delete[] (qse_uint8_t*)block;
this->mmgr->dispose ((qse_uint8_t*)block);
this->getMmgr()->dispose ((qse_uint8_t*)block);
block = next;
}
@ -107,7 +107,7 @@ Mpool::Block* Mpool::add_block ()
//Block* block = (Block*)::new qse_uint8_t[
// QSE_SIZEOF(Block) + this->block_size * this->datum_size];
Block* block = (Block*)this->mmgr->allocate (QSE_SIZEOF(Block) + this->block_size * this->datum_size);
Block* block = (Block*)this->getMmgr()->allocate (QSE_SIZEOF(Block) + this->block_size * this->datum_size);
if (!block) return QSE_NULL; // this line may not be reached if the allocator raises an exception
//this->free_list = (Chain*)block->data;

View File

@ -35,7 +35,7 @@ QSE_BEGIN_NAMESPACE(QSE)
int Sed::open ()
{
sed = qse_sed_open (this->mmgr, QSE_SIZEOF(Sed*));
sed = qse_sed_open (this->getMmgr(), QSE_SIZEOF(Sed*));
if (!sed) return -1;
*(Sed**)QSE_XTN(sed) = this;