Skip to content

Commit 6a8dc38

Browse files
committed
cleanup(utils): Remove unnecessary read_names_in_directory helper
Signed-off-by: Philipp Jungkamp <philipp.jungkamp@rwth-aachen.de>
1 parent fd005c9 commit 6a8dc38

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

common/include/villas/utils.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ template <class... Ts> struct overloaded : Ts... {
132132
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
133133

134134
void write_to_file(std::string data, const fs::path file);
135-
std::vector<std::string> read_names_in_directory(const fs::path &directory);
136135

137136
namespace base64 {
138137

common/lib/kernel/devices/ip_device.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,9 @@ std::vector<villas::kernel::devices::IpDevice>
5858
IpDevice::from_directory(fs::path devices_directory) {
5959
std::vector<villas::kernel::devices::IpDevice> devices;
6060

61-
const std::vector<std::string> devicetree_names =
62-
villas::utils::read_names_in_directory(devices_directory);
63-
64-
for (auto devicetree_name : devicetree_names) {
65-
auto path_to_device = devices_directory / fs::path(devicetree_name);
61+
for (auto devicetree : fs::directory_iterator{devices_directory}) {
6662
try {
67-
auto device = villas::kernel::devices::IpDevice::from(path_to_device);
63+
auto device = villas::kernel::devices::IpDevice::from(devicetree.path());
6864
devices.push_back(device);
6965
} catch (std::runtime_error &e) {
7066
}

common/lib/utils.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,5 @@ void write_to_file(std::string data, const fs::path file) {
364364
}
365365
}
366366

367-
std::vector<std::string> read_names_in_directory(const fs::path &directory) {
368-
std::vector<std::string> names;
369-
for (auto const &dir_entry : fs::directory_iterator{directory}) {
370-
names.push_back(dir_entry.path().filename());
371-
}
372-
return names;
373-
}
374-
375367
} // namespace utils
376368
} // namespace villas

0 commit comments

Comments
 (0)