diff options
author | Ed Tanous <ed@tanous.net> | 2020-09-30 02:16:58 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2020-10-15 18:52:46 +0300 |
commit | b5a76932eab7d40487ffb305cd745ec155813c4e (patch) | |
tree | 193d0ba4e679be07880d661130930cd4adcb38b9 /redfish-core/lib/ethernet.hpp | |
parent | c370fad0ae67480fac19a2fe6a08be3401f48ae7 (diff) | |
download | bmcweb-b5a76932eab7d40487ffb305cd745ec155813c4e.tar.xz |
Lots of performance improvements
(In the voice of the kid from sixth sense) I see string copies...
Apparently there are a lot of places we make unnecessary copies. This
fixes all of them.
Not sure how to split this up into smaller patches, or if it even needs
split up. It seems pretty easy to review to me, because basically every
diff is identical.
Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369
Signed-off-by: Ed Tanous <ed@tanous.net>
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Diffstat (limited to 'redfish-core/lib/ethernet.hpp')
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 1fb8783d20..05f5d5541c 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -697,7 +697,7 @@ inline bool ipv4VerifyIpAndGetBitcount(const std::string& ip, * @return None */ inline void deleteIPv4(const std::string& ifaceId, const std::string& ipHash, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec) { @@ -724,7 +724,7 @@ inline void deleteIPv4(const std::string& ifaceId, const std::string& ipHash, */ inline void createIPv4(const std::string& ifaceId, uint8_t prefixLength, const std::string& gateway, const std::string& address, - std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec) { @@ -757,7 +757,7 @@ inline void deleteAndCreateIPv4(const std::string& ifaceId, const std::string& id, uint8_t prefixLength, const std::string& gateway, const std::string& address, - std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { crow::connections::systemBus->async_method_call( [asyncResp, ifaceId, address, prefixLength, @@ -794,7 +794,7 @@ inline void deleteAndCreateIPv4(const std::string& ifaceId, * @return None */ inline void deleteIPv6(const std::string& ifaceId, const std::string& ipHash, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec) { @@ -823,7 +823,7 @@ inline void deleteIPv6(const std::string& ifaceId, const std::string& ipHash, inline void deleteAndCreateIPv6(const std::string& ifaceId, const std::string& id, uint8_t prefixLength, const std::string& address, - std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { crow::connections::systemBus->async_method_call( [asyncResp, ifaceId, address, @@ -862,7 +862,7 @@ inline void deleteAndCreateIPv6(const std::string& ifaceId, */ inline void createIPv6(const std::string& ifaceId, uint8_t prefixLength, const std::string& address, - std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { auto createIpHandler = [asyncResp](const boost::system::error_code ec) { if (ec) @@ -1080,7 +1080,7 @@ class EthernetInterface : public Node private: void handleHostnamePatch(const std::string& hostname, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { // SHOULD handle host names of up to 255 characters(RFC 1123) if (hostname.length() > 255) @@ -1105,7 +1105,7 @@ class EthernetInterface : public Node void handleDomainnamePatch(const std::string& ifaceId, const std::string& domainname, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { std::vector<std::string> vectorDomainname = {domainname}; crow::connections::systemBus->async_method_call( @@ -1123,7 +1123,7 @@ class EthernetInterface : public Node } void handleFqdnPatch(const std::string& ifaceId, const std::string& fqdn, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { // Total length of FQDN must not exceed 255 characters(RFC 1035) if (fqdn.length() > 255) @@ -1203,7 +1203,7 @@ class EthernetInterface : public Node void setDHCPEnabled(const std::string& ifaceId, const std::string& propertyName, const bool v4Value, const bool v6Value, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { const std::string dhcp = getDhcpEnabledEnumeration(v4Value, v6Value); crow::connections::systemBus->async_method_call( @@ -1224,7 +1224,7 @@ class EthernetInterface : public Node void setEthernetInterfaceBoolProperty( const std::string& ifaceId, const std::string& propertyName, - const bool& value, const std::shared_ptr<AsyncResp> asyncResp) + const bool& value, const std::shared_ptr<AsyncResp>& asyncResp) { crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec) { @@ -1243,7 +1243,7 @@ class EthernetInterface : public Node } void setDHCPv4Config(const std::string& propertyName, const bool& value, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << propertyName << " = " << value; crow::connections::systemBus->async_method_call( @@ -1265,7 +1265,7 @@ class EthernetInterface : public Node void handleDHCPPatch(const std::string& ifaceId, const EthernetInterfaceData& ethData, DHCPParameters v4dhcpParms, DHCPParameters v6dhcpParms, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { bool ipv4Active = translateDHCPEnabledToBool(ethData.DHCPEnabled, true); bool ipv6Active = @@ -1376,7 +1376,8 @@ class EthernetInterface : public Node boost::container::flat_set<IPv4AddressData>::const_iterator getNextStaticIpEntry( boost::container::flat_set<IPv4AddressData>::const_iterator head, - boost::container::flat_set<IPv4AddressData>::const_iterator end) + const boost::container::flat_set<IPv4AddressData>::const_iterator& + end) { for (; head != end; head++) { @@ -1391,7 +1392,8 @@ class EthernetInterface : public Node boost::container::flat_set<IPv6AddressData>::const_iterator getNextStaticIpEntry( boost::container::flat_set<IPv6AddressData>::const_iterator head, - boost::container::flat_set<IPv6AddressData>::const_iterator end) + const boost::container::flat_set<IPv6AddressData>::const_iterator& + end) { for (; head != end; head++) { @@ -1406,7 +1408,7 @@ class EthernetInterface : public Node void handleIPv4StaticPatch( const std::string& ifaceId, nlohmann::json& input, const boost::container::flat_set<IPv4AddressData>& ipv4Data, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { if ((!input.is_array()) || input.empty()) { @@ -1601,7 +1603,7 @@ class EthernetInterface : public Node void handleIPv6StaticAddressesPatch( const std::string& ifaceId, nlohmann::json& input, const boost::container::flat_set<IPv6AddressData>& ipv6Data, - const std::shared_ptr<AsyncResp> asyncResp) + const std::shared_ptr<AsyncResp>& asyncResp) { if (!input.is_array() || input.empty()) { @@ -1712,8 +1714,8 @@ class EthernetInterface : public Node } void parseInterfaceData( - std::shared_ptr<AsyncResp> asyncResp, const std::string& iface_id, - const EthernetInterfaceData& ethData, + const std::shared_ptr<AsyncResp>& asyncResp, + const std::string& iface_id, const EthernetInterfaceData& ethData, const boost::container::flat_set<IPv4AddressData>& ipv4Data, const boost::container::flat_set<IPv6AddressData>& ipv6Data) { |