/s/boost::beast::span/std::span
std::span is now available in c++ 20 builds, and should be a drop in
replacement for boost::span we were using previously. This commit sed
replaces it, and changes reference to cbegin and cend to begin and end
respectively.
Tested:
Ran redfish-service-validator. No new failures, and all nodes within
/redfish/v1/Registries that would be effected by this change respond
with 200 and the same content as previously.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iace89473b7c20f32106eae9d872c16cfae5f17f6
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index d273aea..da9a165 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -416,13 +416,13 @@
// Check for Message ID in each of the selected Registry
for (const std::string& it : registryPrefix)
{
- const boost::beast::span<
+ const std::span<
const redfish::message_registries::MessageEntry>
registry = redfish::message_registries::
getRegistryFromPrefix(it);
if (std::any_of(
- registry.cbegin(), registry.cend(),
+ registry.begin(), registry.end(),
[&id](const redfish::message_registries::
MessageEntry& messageEntry) {
return !id.compare(messageEntry.first);
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 65b12f3..f71f81b 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -39,6 +39,7 @@
#include <charconv>
#include <filesystem>
#include <optional>
+#include <span>
#include <string_view>
#include <variant>
@@ -57,17 +58,16 @@
namespace message_registries
{
-static const Message* getMessageFromRegistry(
- const std::string& messageKey,
- const boost::beast::span<const MessageEntry> registry)
+static const Message*
+ getMessageFromRegistry(const std::string& messageKey,
+ const std::span<const MessageEntry> registry)
{
- boost::beast::span<const MessageEntry>::const_iterator messageIt =
- std::find_if(registry.cbegin(), registry.cend(),
- [&messageKey](const MessageEntry& messageEntry) {
- return !std::strcmp(messageEntry.first,
- messageKey.c_str());
- });
- if (messageIt != registry.cend())
+ std::span<const MessageEntry>::iterator messageIt = std::find_if(
+ registry.begin(), registry.end(),
+ [&messageKey](const MessageEntry& messageEntry) {
+ return !std::strcmp(messageEntry.first, messageKey.c_str());
+ });
+ if (messageIt != registry.end())
{
return &messageIt->second;
}
@@ -90,13 +90,12 @@
if (std::string(base::header.registryPrefix) == registryName)
{
return getMessageFromRegistry(
- messageKey, boost::beast::span<const MessageEntry>(base::registry));
+ messageKey, std::span<const MessageEntry>(base::registry));
}
if (std::string(openbmc::header.registryPrefix) == registryName)
{
return getMessageFromRegistry(
- messageKey,
- boost::beast::span<const MessageEntry>(openbmc::registry));
+ messageKey, std::span<const MessageEntry>(openbmc::registry));
}
return nullptr;
}
@@ -1135,7 +1134,7 @@
}
// Get the MessageArgs from the log if there are any
- boost::beast::span<std::string> messageArgs;
+ std::span<std::string> messageArgs;
if (logEntryFields.size() > 1)
{
std::string& messageArgsStart = logEntryFields[1];