diff options
author | Ed Tanous <edtanous@google.com> | 2023-01-20 06:03:17 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-02-17 06:28:23 +0300 |
commit | 50ebd4af91ece2e7b5e75b600f83a2a74b315068 (patch) | |
tree | 94f4efb8624af4cb3aac1bf71ab6f4bf0df70e37 /redfish-core/lib | |
parent | 455ccdf33c4580eb9ac3e71152fa8854266b7fbc (diff) | |
download | bmcweb-50ebd4af91ece2e7b5e75b600f83a2a74b315068.tar.xz |
Implement alternative to on boost::split
boost::split has a documented false-positive in clang-tidy. While
normally we'd handle this with NOLINTNEXTLINE, this doesn't appear to
work in all cases. Unclear why, but seems to be due to some of our
lambda callback complexity.
Each of these uses is a case where we should be using a more specific
check, rather than split, but for the moment, this is the best we have.
Tested: clang-tidy passes.
[1] https://github.com/llvm/llvm-project/issues/40486
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I144c6610cb740287b7225e2be03b4142a64f9563
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/log_services.hpp | 7 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 7 |
2 files changed, 7 insertions, 7 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index ef1652bd72..89c38b0e8a 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -98,7 +98,7 @@ static const Message* getMessage(const std::string_view& messageID) // the right Message std::vector<std::string> fields; fields.reserve(4); - boost::split(fields, messageID, boost::is_any_of(".")); + bmcweb::split(fields, messageID, '.'); const std::string& registryName = fields[0]; const std::string& messageKey = fields[3]; @@ -1238,8 +1238,7 @@ static LogParseError entry.remove_prefix(entryStart); // Use split to separate the entry into its fields std::vector<std::string> logEntryFields; - boost::split(logEntryFields, entry, boost::is_any_of(","), - boost::token_compress_on); + bmcweb::split(logEntryFields, entry, ','); // We need at least a MessageId to be valid if (logEntryFields.empty()) { @@ -3616,7 +3615,7 @@ inline static bool parsePostCode(const std::string& postCodeID, uint64_t& currentValue, uint16_t& index) { std::vector<std::string> split; - boost::algorithm::split(split, postCodeID, boost::is_any_of("-")); + bmcweb::split(split, postCodeID, '-'); if (split.size() != 2 || split[0].length() < 2 || split[0].front() != 'B') { return false; diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 6be9e86bc1..e6d7a7a663 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -21,6 +21,7 @@ #include "generated/enums/sensor.hpp" #include "query.hpp" #include "registries/privilege_registry.hpp" +#include "str_utility.hpp" #include "utils/dbus_utils.hpp" #include "utils/json_utils.hpp" #include "utils/query_param.hpp" @@ -29,7 +30,6 @@ #include <boost/algorithm/string/find.hpp> #include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/replace.hpp> -#include <boost/algorithm/string/split.hpp> #include <boost/range/algorithm/replace_copy_if.hpp> #include <boost/system/error_code.hpp> #include <sdbusplus/asio/property.hpp> @@ -2281,14 +2281,15 @@ inline void getSensorData( // Reserve space for // /xyz/openbmc_project/sensors/<name>/<subname> split.reserve(6); - boost::algorithm::split(split, objPath, boost::is_any_of("/")); + // NOLINTNEXTLINE + bmcweb::split(split, objPath, '/'); if (split.size() < 6) { BMCWEB_LOG_ERROR << "Got path that isn't long enough " << objPath; continue; } - // These indexes aren't intuitive, as boost::split puts an empty + // These indexes aren't intuitive, as split puts an empty // string at the beginning const std::string& sensorType = split[4]; const std::string& sensorName = split[5]; |