_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 _fheapchk( void ) { struct _heapinfo hi; int heap_status; unsigned long free_size; _AccessFHeap(); heap_status = checkFreeList( &free_size ); if( heap_status != _HEAPOK ) { _ReleaseFHeap(); return( heap_status ); } hi._pentry = NULL; while( (heap_status = __HeapWalk( &hi, __fheapbeg, _NULLSEG )) == _HEAPOK ) { if( hi._useflag == _FREEENTRY ) { heap_status = checkFree( 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; } _ReleaseFHeap(); return( heap_status ); }
void jobFree(struct job **pEl) /* Free a single dynamically allocated job such as created * with jobLoad(). */ { struct job *el; if ((el = *pEl) == NULL) return; freeMem(el->command); checkFreeList(&el->checkList); submissionFreeList(&el->submissionList); freeMem(el->spec); freez(pEl); }