From 296579be4c16e570ba8dcc65e7fe992cdc03e2a3 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Mon, 11 Mar 2024 16:58:24 -0700 Subject: Call dump() less nlohmann::json::dump() is not an easy function to get the call parameters correct on. We should limit the places we use it. Luckily, both logging and redfish::messages support printing json values directly. Use them where appropriate. Tested: Error logging and out of range calls only of heavily used messages and logging calls. Inspection only. Change-Id: I57521d8791dd95250c93e8e3b2d4a959740ac713 Signed-off-by: Ed Tanous --- redfish-core/lib/network_protocol.hpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'redfish-core') diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index c57343c3bd..31fc5afc04 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -294,21 +294,17 @@ inline void { if (!ntpServerObject->empty()) { - messages::propertyValueNotInList( - asyncResp->res, - ntpServer.dump(2, ' ', true, - nlohmann::json::error_handler_t::replace), - "NTP/NTPServers/" + std::to_string(index)); + messages::propertyValueNotInList(asyncResp->res, ntpServer, + "NTP/NTPServers/" + + std::to_string(index)); return; } // Can't retain an item that doesn't exist if (currentNtpServer == currentNtpServers.end()) { - messages::propertyValueOutOfRange( - asyncResp->res, - ntpServer.dump(2, ' ', true, - nlohmann::json::error_handler_t::replace), - "NTP/NTPServers/" + std::to_string(index)); + messages::propertyValueOutOfRange(asyncResp->res, ntpServer, + "NTP/NTPServers/" + + std::to_string(index)); return; } @@ -321,11 +317,9 @@ inline void ntpServer.get_ptr(); if (ntpServerStr == nullptr) { - messages::propertyValueTypeError( - asyncResp->res, - ntpServer.dump(2, ' ', true, - nlohmann::json::error_handler_t::replace), - "NTP/NTPServers/" + std::to_string(index)); + messages::propertyValueTypeError(asyncResp->res, ntpServer, + "NTP/NTPServers/" + + std::to_string(index)); return; } if (currentNtpServer == currentNtpServers.end()) -- cgit v1.2.3