Changeset 7027 for trunk/src/kernel32/os2heap.cpp
- Timestamp:
- Oct 12, 2001, 5:48:06 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/os2heap.cpp
r6975 r7027 1 /* $Id: os2heap.cpp,v 1.2 6 2001-10-09 20:25:20 sandervlExp $ */1 /* $Id: os2heap.cpp,v 1.27 2001-10-12 03:48:06 phaller Exp $ */ 2 2 3 3 /* … … 45 45 void _LNK_CONV releaseHeapMem(Heap_t pHeap, void *block, size_t size); 46 46 47 48 //****************************************************************************** 49 // Fast Heap Handle Management 50 //****************************************************************************** 51 52 static HANDLE fhhm_lastHandle = 0; 53 static OS2Heap* fhhm_lastHeap = NULL; 54 55 47 56 //****************************************************************************** 48 57 //****************************************************************************** 49 58 OS2Heap::OS2Heap(DWORD flOptions, DWORD dwInitialSize, DWORD dwMaximumSize) 50 59 { 51 OS2Heap *curheap = OS2Heap::heap;52 60 OS2Heap *curheap = OS2Heap::heap; 61 53 62 totalAlloc = 0; 54 63 fInitialized = 0; … … 98 107 OS2Heap *curheap = OS2Heap::heap; 99 108 int i; 100 109 110 // invalidate handle cache 111 fhhm_lastHandle = 0; 112 fhhm_lastHeap = NULL; 113 114 101 115 dprintf(("dtr OS2Heap, hPrimaryHeap = %X\n", hPrimaryHeap)); 102 116 … … 291 305 OS2Heap *OS2Heap::find(HANDLE hHeap) 292 306 { 307 // check against cache first 308 if (fhhm_lastHeap) 309 if (hHeap == fhhm_lastHandle) 310 return fhhm_lastHeap; 311 293 312 OS2Heap *curheap = OS2Heap::heap; 294 313 295 314 //@@@PH NT programs seem to assume heap 0 is always valid?! 296 315 if (hHeap == 0) 297 if (curheap != NULL) 298 return curheap; 299 300 while(curheap != NULL) { 301 if(curheap->hPrimaryHeap == hHeap) { 302 return(curheap); 303 } 304 curheap = curheap->next; 316 if (curheap != NULL) 317 { 318 fhhm_lastHandle = hHeap; 319 fhhm_lastHeap = curheap; 320 return curheap; 321 } 322 323 while(curheap != NULL) 324 { 325 if(curheap->hPrimaryHeap == hHeap) 326 { 327 fhhm_lastHandle = hHeap; 328 fhhm_lastHeap = curheap; 329 return(curheap); 330 } 331 curheap = curheap->next; 305 332 } 306 333 dprintf(("Heap %X not found!\n", hHeap)); 334 fhhm_lastHandle = hHeap; 335 fhhm_lastHeap = NULL; 307 336 return(NULL); 308 337 }
Note:
See TracChangeset
for help on using the changeset viewer.