static void FiniHandle( void ) { int i; for( i = 0; i < handle_count; i++ ) if( handle_ptr[i] ) FreeHandleObj( handle_ptr[i] ); lib_free( handle_ptr ); RdosDeleteSection( handle_section ); }
_WCRTLINK int close( int handle ) { rdos_handle_type *obj; obj = FreeHandleEntry( handle ); if( obj ) { FreeHandleObj( obj ); return( 0 ); } return( -1 ); }
static int ReplaceHandleEntry( int handle, rdos_handle_type *new_obj ) { int ok = 0; rdos_handle_type *obj = 0; RdosEnterKernelSection( &handle_section ); if( handle >= 0 && handle < handle_count ) { if( handle_ptr[handle] ) obj = handle_ptr[handle]; handle_ptr[handle] = new_obj; ok = 1; } RdosLeaveKernelSection( &handle_section ); if( obj ) FreeHandleObj( obj ); return ( ok ); }