diff options
author | Robert Göffringmann | 2003-12-20 09:12:54 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-12-20 09:12:54 +0000 |
commit | 59654b17191b99c23486f6a41076b9ed05a1c38f (patch) | |
tree | f088012a40319619f80b8e81082779bb6512f737 /sword1/memman.cpp | |
parent | aceafcbb484f18aedda914bf321585a9c113016a (diff) | |
download | scummvm-rg350-59654b17191b99c23486f6a41076b9ed05a1c38f.tar.gz scummvm-rg350-59654b17191b99c23486f6a41076b9ed05a1c38f.tar.bz2 scummvm-rg350-59654b17191b99c23486f6a41076b9ed05a1c38f.zip |
added SwordControl (the control panel). Not yet finished.
svn-id: r11775
Diffstat (limited to 'sword1/memman.cpp')
-rw-r--r-- | sword1/memman.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sword1/memman.cpp b/sword1/memman.cpp index bee3c736ae..a8cded00e3 100644 --- a/sword1/memman.cpp +++ b/sword1/memman.cpp @@ -67,6 +67,18 @@ void MemMan::setCondition(BsMemHandle *bsMem, uint16 pCond) { } } +void MemMan::flush(void) { + while (_memListFree) { + free(_memListFreeEnd->data); + _memListFreeEnd->data = NULL; + _memListFreeEnd->cond = MEM_FREED; + _alloced -= _memListFreeEnd->size; + removeFromFreeList(_memListFreeEnd); + } + if (_alloced) + warning("MemMan::flush: Something's wrong: still %d bytes alloced", _alloced); +} + void MemMan::checkMemoryUsage(void) { while ((_alloced > MAX_ALLOC) && _memListFree) { free(_memListFreeEnd->data); @@ -92,19 +104,6 @@ void MemMan::addToFreeList(BsMemHandle *bsMem) { } void MemMan::removeFromFreeList(BsMemHandle *bsMem) { - /*BsMemHandle *forw = _memListFree; - BsMemHandle *rev = _memListFreeEnd; - - while (forw || rev) { - if (!(forw && rev)) - error("mem list is completely fubared"); - printf("%p <-> %p\n", forw, rev); - forw = forw->next; - rev = rev->prev; - } - printf("\n");*/ - if (!(bsMem->prev || bsMem->next)) - warning("removeFromFreeList: memory block wasn't in list"); if (_memListFree == bsMem) _memListFree = bsMem->next; if (_memListFreeEnd == bsMem) |