@ -137,6 +137,7 @@ inv_args:
else if ( ! argv [ 2 ] )
else if ( ! argv [ 2 ] )
goto inv_args ;
goto inv_args ;
int m_rval = 0 ;
map_t needle ;
map_t needle ;
INFO ( " Mapping needle file `%s' " , argv [ 1 ] ) ;
INFO ( " Mapping needle file `%s' " , argv [ 1 ] ) ;
if ( ! map_handle_err ( map_file ( argv [ 1 ] , false , 0 , 0 , & needle ) ) ) return PROG_RET_MAP_NEEDLE_FAILED ;
if ( ! map_handle_err ( map_file ( argv [ 1 ] , false , 0 , 0 , & needle ) ) ) return PROG_RET_MAP_NEEDLE_FAILED ;
@ -148,7 +149,11 @@ inv_args:
usize hsn = AS ( argc - 2 , usize ) ;
usize hsn = AS ( argc - 2 , usize ) ;
map_t haystacks [ hsn ] ;
map_t haystacks [ hsn ] ;
TRACE ( " Attempting to map %lu haystacks " , hsn ) ;
TRACE ( " Attempting to map %lu haystacks " , hsn ) ;
if ( ! map_haystacks ( ( const char * * ) ( argv + 1 ) , haystacks ) ) return PROG_RET_MAP_HAYSTACK_FAILED ;
if ( ! map_haystacks ( ( const char * * ) ( argv + 1 ) , haystacks ) ) {
// Unmap needle before return.
if ( ! map_handle_err ( map_free ( needle ) ) ) WARN ( " Failed to unmap needle before exiting after failed haystack maps " ) ;
return PROG_RET_MAP_HAYSTACK_FAILED ;
}
# ifdef _FEATURE_PARALLEL // Multi-threaded
# ifdef _FEATURE_PARALLEL // Multi-threaded
TODO ( " Multithreaded processing currently unimplemented. " ) ;
TODO ( " Multithreaded processing currently unimplemented. " ) ;
@ -170,7 +175,6 @@ inv_args:
free ( full_result ) ;
free ( full_result ) ;
# endif
# endif
int m_rval = 0 ;
for ( int i = 0 ; i < ( int ) hsn ; i + + ) {
for ( int i = 0 ; i < ( int ) hsn ; i + + ) {
INFO ( " Unmapping haystack haystack file `%s' (#%d) (map addr %p) " , argv [ i + 1 ] , i + 1 , haystacks + i ) ;
INFO ( " Unmapping haystack haystack file `%s' (#%d) (map addr %p) " , argv [ i + 1 ] , i + 1 , haystacks + i ) ;
if ( ! map_handle_err ( map_free ( haystacks [ i ] ) ) ) m_rval = ! m_rval ? PROG_RET_UNMAP_HAYSTACK_N_FAILED ( i + 1 ) : m_rval ;
if ( ! map_handle_err ( map_free ( haystacks [ i ] ) ) ) m_rval = ! m_rval ? PROG_RET_UNMAP_HAYSTACK_N_FAILED ( i + 1 ) : m_rval ;