1
0
Fork 0

Allow reallocation of memory handles to 0 pages.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1231
This commit is contained in:
Sjoerd van der Berg 2003-09-07 14:35:41 +00:00
parent 20083140da
commit 7d2bdc65e3

View file

@ -565,11 +565,17 @@ void MEM_ReleasePages(MemHandle handle) {
}
bool MEM_ReAllocatePages(MemHandle & handle,Bitu pages,bool sequence) {
MemHandle index=handle;
if (index<0 || !pages) {
E_Exit("MEM:Resized to size 0");
return 0;
if (handle<0) {
if (!pages) return true;
handle=MEM_AllocatePages(pages,sequence);
return (handle>0);
}
if (!pages) {
MEM_ReleasePages(handle);
handle=-1;
return true;
}
MemHandle index=handle;
MemHandle last;Bitu old_pages=0;
while (index>0) {
old_pages++;