diff options
author | Max Horn | 2009-10-13 18:53:50 +0000 |
---|---|---|
committer | Max Horn | 2009-10-13 18:53:50 +0000 |
commit | 296dd543443e15c97366bab40a732c7eff9cfd34 (patch) | |
tree | 75fd5e82956db5987d1e5134e0bb253719d60ca8 /engines/sci/engine/seg_manager.cpp | |
parent | c77be11ccd81afb92e5f2e2620295fa65dc3124d (diff) | |
download | scummvm-rg350-296dd543443e15c97366bab40a732c7eff9cfd34.tar.gz scummvm-rg350-296dd543443e15c97366bab40a732c7eff9cfd34.tar.bz2 scummvm-rg350-296dd543443e15c97366bab40a732c7eff9cfd34.zip |
SCI: Merge SegManager::alloc_Hunk into SegManager::allocateHunkEntry
svn-id: r45041
Diffstat (limited to 'engines/sci/engine/seg_manager.cpp')
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index c318be21c9..dd635d2146 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -735,8 +735,18 @@ void SegManager::freeHunkEntry(reg_t addr) { ht->freeEntry(addr.offset); } -Hunk *SegManager::allocateHunkEntry(const char *hunk_type, int size, reg_t *reg) { - Hunk *h = alloc_Hunk(reg); +Hunk *SegManager::allocateHunkEntry(const char *hunk_type, int size, reg_t *addr) { + HunkTable *table; + int offset; + + if (!Hunks_seg_id) + allocSegment(new HunkTable(), &(Hunks_seg_id)); + table = (HunkTable *)_heap[Hunks_seg_id]; + + offset = table->allocEntry(); + + *addr = make_reg(Hunks_seg_id, offset); + Hunk *h = &(table->_table[offset]); if (!h) return NULL; @@ -752,9 +762,9 @@ Clone *SegManager::allocateClone(reg_t *addr) { CloneTable *table; int offset; - if (!Clones_seg_id) { + if (!Clones_seg_id) table = (CloneTable *)allocSegment(new CloneTable(), &(Clones_seg_id)); - } else + else table = (CloneTable *)_heap[Clones_seg_id]; offset = table->allocEntry(); @@ -824,20 +834,6 @@ Node *SegManager::allocateNode(reg_t *addr) { return &(table->_table[offset]); } -Hunk *SegManager::alloc_Hunk(reg_t *addr) { - HunkTable *table; - int offset; - - if (!Hunks_seg_id) - allocSegment(new HunkTable(), &(Hunks_seg_id)); - table = (HunkTable *)_heap[Hunks_seg_id]; - - offset = table->allocEntry(); - - *addr = make_reg(Hunks_seg_id, offset); - return &(table->_table[offset]); -} - List *SegManager::lookupList(reg_t addr) { if (getSegmentType(addr.segment) != SEG_TYPE_LISTS) { warning("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr)); |