From b2f4194bb22acb671ea6b41f8cf1c5e86229bb22 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 18 Aug 2002 19:14:04 +0000 Subject: [PATCH] Remove extraneous find_close() call; thanks to Thomas Witt [SVN r392] --- src/operations_posix_windows.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/operations_posix_windows.cpp b/src/operations_posix_windows.cpp index ed5be0f..4698239 100644 --- a/src/operations_posix_windows.cpp +++ b/src/operations_posix_windows.cpp @@ -68,7 +68,11 @@ namespace == BOOST_INVALID_HANDLE_VALUE ) ? 0 : dummy_first_name; } - inline void find_close( BOOST_HANDLE handle ) { ::closedir( handle ); } + inline void find_close( BOOST_HANDLE handle ) + { + assert( handle != BOOST_INVALID_HANDLE_VALUE ); + ::closedir( handle ); + } inline const char * find_next_file( BOOST_HANDLE handle, BOOST_SYSTEM_DIRECTORY_TYPE & ) @@ -87,11 +91,7 @@ namespace { throw fs::filesystem_error( "directory_iterator ++() failure" ); } - else // eof - { - find_close( handle ); - return 0; - } + else { return 0; } // end reached } return dp->d_name; } @@ -110,7 +110,11 @@ namespace == BOOST_INVALID_HANDLE_VALUE ) ? 0 : data.cFileName; } - inline void find_close( BOOST_HANDLE handle ) { ::FindClose( handle ); } + inline void find_close( BOOST_HANDLE handle ) + { + assert( handle != BOOST_INVALID_HANDLE_VALUE ); + ::FindClose( handle ); + } inline const char * find_next_file( BOOST_HANDLE handle, BOOST_SYSTEM_DIRECTORY_TYPE & data ) @@ -124,12 +128,8 @@ namespace throw fs::filesystem_error( "directory_iterator ++() failure", fs::system_error ); } - else // eof - { - find_close( handle ); - return 0; - } - } + else { return 0; } // end reached + } return data.cFileName; } @@ -178,10 +178,7 @@ namespace boost ~directory_iterator_imp() { - if ( handle != BOOST_INVALID_HANDLE_VALUE ) - { - find_close( handle ); - } + if ( handle != BOOST_INVALID_HANDLE_VALUE ) find_close( handle ); } };