Drop intermediate list of files from log reading
We are saving a temporary variable in a ton of places for the lifetime
of the program. Inline it so we can change the return type.
Change-Id: If8d90ffd07806644aceed4c44087e5fd206c8df9
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/y2023/localizer/localizer_replay.cc b/y2023/localizer/localizer_replay.cc
index 27fdd85..859b77e 100644
--- a/y2023/localizer/localizer_replay.cc
+++ b/y2023/localizer/localizer_replay.cc
@@ -25,13 +25,9 @@
const aos::FlatbufferDetachedBuffer<aos::Configuration> config =
aos::configuration::ReadConfig(FLAGS_config);
- // find logfiles
- std::vector<std::string> unsorted_logfiles =
- aos::logger::FindLogs(argc, argv);
-
// sort logfiles
const std::vector<aos::logger::LogFile> logfiles =
- aos::logger::SortParts(unsorted_logfiles);
+ aos::logger::SortParts(aos::logger::FindLogs(argc, argv));
// open logfiles
aos::logger::LogReader reader(logfiles, &config.message());
diff --git a/y2023/vision/target_mapping.cc b/y2023/vision/target_mapping.cc
index 985a412..2ca6f66 100644
--- a/y2023/vision/target_mapping.cc
+++ b/y2023/vision/target_mapping.cc
@@ -398,9 +398,6 @@
}
void MappingMain(int argc, char *argv[]) {
- std::vector<std::string> unsorted_logfiles =
- aos::logger::FindLogs(argc, argv);
-
std::vector<DataAdapter::TimestampedDetection> timestamped_target_detections;
std::optional<aos::FlatbufferDetachedBuffer<aos::Configuration>> config =
@@ -410,7 +407,7 @@
// Open logfiles
aos::logger::LogReader reader(
- aos::logger::SortParts(unsorted_logfiles),
+ aos::logger::SortParts(aos::logger::FindLogs(argc, argv)),
config.has_value() ? &config->message() : nullptr);
TargetMapperReplay mapper_replay(&reader);