_WCRTLINK int _nheapchk( void ) { struct _heapinfo hi; int heap_status; size_t free_size; _AccessNHeap(); heap_status = checkFreeList( &free_size ); if( heap_status != _HEAPOK ) { _ReleaseNHeap(); return( heap_status ); } hi._pentry = NULL; for(;;) { heap_status = __NHeapWalk( &hi, __nheapbeg ); if( heap_status != _HEAPOK ) break; if( hi._useflag == _FREEENTRY ) { heap_status = checkFree( (frlptr) hi._pentry ); if( heap_status != _HEAPOK ) break; free_size -= hi._size; } } if( free_size != 0 ) { heap_status = _HEAPBADNODE; } else if( heap_status == _HEAPBADPTR ) { heap_status = _HEAPBADNODE; } else { if( heap_status == _HEAPEND ) { heap_status = _HEAPOK; } } _ReleaseNHeap(); return( heap_status ); }
_WCRTLINK int _nheapwalk( struct _heapinfo *entry ) { int heap_status; _AccessNHeap(); heap_status = __NHeapWalk( entry, __nheapbeg ); _ReleaseNHeap(); return( heap_status ); }