diff options
author | Ed Tanous <edtanous@google.com> | 2023-07-18 20:07:23 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-01-19 22:43:50 +0300 |
commit | 18f8f608b966c802b3e2a389e3c1ec5a1fd9407b (patch) | |
tree | 89684cb74b7492ffc1e34fb8e3a004de18726071 /include/ibm | |
parent | f86bcc875a496b3c321a4ed102579a4031617800 (diff) | |
download | bmcweb-18f8f608b966c802b3e2a389e3c1ec5a1fd9407b.tar.xz |
Remove some boost includes
The less we rely on boost, and more on std algorithms, the less people
have to look up, and the more likely that our code will deduplicate.
Replace all uses of boost::algorithms with std alternatives.
Tested: Redfish Service Validator passes.
Change-Id: I8a26f39b5709adc444b4178e92f5f3c7b988b05b
Signed-off-by: Ed Tanous <edtanous@google.com>
Diffstat (limited to 'include/ibm')
-rw-r--r-- | include/ibm/locks.hpp | 25 | ||||
-rw-r--r-- | include/ibm/management_console_rest.hpp | 4 |
2 files changed, 13 insertions, 16 deletions
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp index 7a161fc754..3bb82b9479 100644 --- a/include/ibm/locks.hpp +++ b/include/ibm/locks.hpp @@ -3,7 +3,6 @@ #include "ibm/utils.hpp" #include "logging.hpp" -#include <boost/algorithm/string/predicate.hpp> #include <boost/container/flat_map.hpp> #include <boost/endian/conversion.hpp> #include <nlohmann/json.hpp> @@ -363,8 +362,8 @@ inline bool Lock::isValidLockRequest(const LockRequest& refLockRecord) { // validate the locktype - if (!((boost::equals(std::get<2>(refLockRecord), "Read") || - (boost::equals(std::get<2>(refLockRecord), "Write"))))) + if (!((std::get<2>(refLockRecord) == "Read" || + (std::get<2>(refLockRecord) == "Write")))) { BMCWEB_LOG_DEBUG("Validation of LockType Failed"); BMCWEB_LOG_DEBUG("Locktype : {}", std::get<2>(refLockRecord)); @@ -392,9 +391,8 @@ inline bool Lock::isValidLockRequest(const LockRequest& refLockRecord) // validate the lock flags // Allowed lockflags are locksame,lockall & dontlock - if (!((boost::equals(p.first, "LockSame") || - (boost::equals(p.first, "LockAll")) || - (boost::equals(p.first, "DontLock"))))) + if (!((p.first == "LockSame" || (p.first == "LockAll") || + (p.first == "DontLock")))) { BMCWEB_LOG_DEBUG("Validation of lock flags failed"); BMCWEB_LOG_DEBUG("{}", p.first); @@ -411,8 +409,7 @@ inline bool Lock::isValidLockRequest(const LockRequest& refLockRecord) return false; } - if ((boost::equals(p.first, "LockSame") || - (boost::equals(p.first, "LockAll")))) + if ((p.first == "LockSame" || (p.first == "LockAll"))) { ++lockFlag; if (lockFlag >= 2) @@ -534,8 +531,8 @@ inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1, { // No conflict if both are read locks - if (boost::equals(std::get<2>(refLockRecord1), "Read") && - boost::equals(std::get<2>(refLockRecord2), "Read")) + if (std::get<2>(refLockRecord1) == "Read" && + std::get<2>(refLockRecord2) == "Read") { BMCWEB_LOG_DEBUG("Both are read locks, no conflict"); return false; @@ -546,8 +543,8 @@ inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1, { // return conflict when any of them is try to lock all resources // under the current resource level. - if (boost::equals(p.first, "LockAll") || - boost::equals(std::get<4>(refLockRecord2)[i].first, "LockAll")) + if (p.first == "LockAll" || + std::get<4>(refLockRecord2)[i].first == "LockAll") { BMCWEB_LOG_DEBUG( "Either of the Comparing locks are trying to lock all " @@ -558,8 +555,8 @@ inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1, // determine if there is a lock-all-with-same-segment-size. // If the current segment sizes are the same,then we should fail. - if ((boost::equals(p.first, "LockSame") || - boost::equals(std::get<4>(refLockRecord2)[i].first, "LockSame")) && + if ((p.first == "LockSame" || + std::get<4>(refLockRecord2)[i].first == "LockSame") && (p.second == std::get<4>(refLockRecord2)[i].second)) { return true; diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp index fd1e2a5cc8..103017bf09 100644 --- a/include/ibm/management_console_rest.hpp +++ b/include/ibm/management_console_rest.hpp @@ -6,9 +6,9 @@ #include "event_service_manager.hpp" #include "ibm/locks.hpp" #include "resource_messages.hpp" +#include "str_utility.hpp" #include "utils/json_utils.hpp" -#include <boost/algorithm/string/predicate.hpp> #include <boost/container/flat_set.hpp> #include <nlohmann/json.hpp> #include <sdbusplus/message/types.hpp> @@ -49,7 +49,7 @@ inline void handleFilePut(const crow::Request& req, std::error_code ec; // Check the content-type of the request boost::beast::string_view contentType = req.getHeaderValue("content-type"); - if (!boost::iequals(contentType, "application/octet-stream")) + if (!bmcweb::asciiIEquals(contentType, "application/octet-stream")) { asyncResp->res.result(boost::beast::http::status::not_acceptable); asyncResp->res.jsonValue["Description"] = contentNotAcceptableMsg; |