Fix 1 AbslSpanParams finding:
* This is a change required to migrate function parameters to absl::Span from const std::vector
See go/vector2span for more information on why you've received this change and why it is important.
This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/absl-span-params-bug for category AbslSpanParams if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* For all other issues such as the formatting of the CL, please file a bug under
go/clrobot-bug.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.
This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/METADATA by
following go/clrobot#how-to-opt-in. Anything wrong with the signup? File a bug
at go/clrobot-bug.
#codehealth
Tested:
Local presubmit tests passed.
PiperOrigin-RevId: 724597509
Change-Id: I39463c59662e45161297bb14f6b7d0d06544e9c9
diff --git a/bmc/persistent_storage_bmc.cc b/bmc/persistent_storage_bmc.cc
index b601fe4..0010a66 100644
--- a/bmc/persistent_storage_bmc.cc
+++ b/bmc/persistent_storage_bmc.cc
@@ -22,6 +22,7 @@
#include "absl/strings/string_view.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
+#include "absl/types/span.h"
namespace persistent_storage {
@@ -266,7 +267,7 @@
// "savedactions_2"
// where the largest id is the most recent file
absl::StatusOr<uint64_t> PersistentStorageManagerBMC::findLargestFileId(
- const std::vector<std::string>& files) {
+ absl::Span<const std::string> files) {
std::error_code ec;
uint64_t largest_id = 0;
for (const auto& entry : files) {
diff --git a/bmc/persistent_storage_bmc.h b/bmc/persistent_storage_bmc.h
index e689ea9..aec1b85 100644
--- a/bmc/persistent_storage_bmc.h
+++ b/bmc/persistent_storage_bmc.h
@@ -9,6 +9,7 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
+#include "absl/types/span.h"
namespace persistent_storage {
// b/359687259 make kRWFSPath and size configurable
@@ -51,8 +52,8 @@
absl::Status keepMostRecentProtos(
safepower_agent_persistence_proto::SavedActions& map,
uint32_t keepNumber = kProtoKeepNumber);
- absl::StatusOr<uint64_t> findLargestFileId
- (const std::vector<std::string>& files);
+ absl::StatusOr<uint64_t> findLargestFileId(
+ absl::Span<const std::string> files);
absl::StatusOr<std::vector<std::string> >
listFiles(absl::string_view file_path);
absl::Status deleteAllFilesExceptLargest(absl::string_view file_path);