mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 02:32:32 +00:00
replace for_each with range loops
No advantage over the latter, which is simpler. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
committed by
Jari Sundell
parent
8b663dd169
commit
84c0d516ef
+8
-12
@@ -68,17 +68,6 @@ PathInput::pressed(int key) {
|
||||
return true;
|
||||
}
|
||||
|
||||
struct _transform_filename {
|
||||
void operator () (utils::directory_entry& entry) {
|
||||
#ifdef __sun__
|
||||
if (entry.s_type & S_IFDIR)
|
||||
#else
|
||||
if (entry.s_type == DT_DIR)
|
||||
#endif
|
||||
entry.s_name += '/';
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
PathInput::receive_do_complete() {
|
||||
lt_log_print(torrent::LOG_UI_EVENTS, "path_input: received completion");
|
||||
@@ -93,7 +82,14 @@ PathInput::receive_do_complete() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::for_each(dir.begin(), dir.end(), _transform_filename());
|
||||
for (auto& entry : dir) {
|
||||
#ifdef __sun__
|
||||
if (entry.s_type & S_IFDIR)
|
||||
#else
|
||||
if (entry.s_type == DT_DIR)
|
||||
#endif
|
||||
entry.s_name += '/';
|
||||
}
|
||||
|
||||
range_type r = find_incomplete(dir, str().substr(dirEnd, get_pos()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user