Skip to content

Commit 4816a1c

Browse files
committed
Simplified path_algorithms::append_separator_if_needed.
1 parent 8dc455e commit 4816a1c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/path.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,15 @@ BOOST_FILESYSTEM_DECL int path_algorithms::compare_v4(path const& left, path con
611611

612612
BOOST_FILESYSTEM_DECL path_algorithms::string_type::size_type path_algorithms::append_separator_if_needed(path& p)
613613
{
614-
if (!p.m_pathname.empty() &&
614+
string_type::size_type size(p.m_pathname.size());
615+
if (size > 0 &&
615616
#ifdef BOOST_WINDOWS_API
616-
*(p.m_pathname.end() - 1) != colon &&
617+
p.m_pathname[size - 1] != colon &&
617618
#endif
618-
!detail::is_directory_separator(*(p.m_pathname.end() - 1)))
619+
!detail::is_directory_separator(p.m_pathname[size - 1]))
619620
{
620-
string_type::size_type tmp(p.m_pathname.size());
621621
p.m_pathname.push_back(path::preferred_separator);
622-
return tmp;
622+
return size;
623623
}
624624
return 0;
625625
}

0 commit comments

Comments
 (0)