From f06461d208333e6367d5670f7718e8fa7b7e849e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 6 Dec 2019 09:43:42 -0500 Subject: [PATCH] Common/Network: Make StringToMacAddress use a string_view This function only ever reads the contents of the string in a non-owning manner, so we can change the parameter over to being a string view. --- Source/Core/Common/Network.cpp | 2 +- Source/Core/Common/Network.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp index 77d835a126..1451440cc2 100644 --- a/Source/Core/Common/Network.cpp +++ b/Source/Core/Common/Network.cpp @@ -43,7 +43,7 @@ std::string MacAddressToString(const MACAddress& mac) mac[4], mac[5]); } -std::optional StringToMacAddress(const std::string& mac_string) +std::optional StringToMacAddress(std::string_view mac_string) { if (mac_string.empty()) return {}; diff --git a/Source/Core/Common/Network.h b/Source/Core/Common/Network.h index 3f3c343fe8..18a2f887e9 100644 --- a/Source/Core/Common/Network.h +++ b/Source/Core/Common/Network.h @@ -7,6 +7,7 @@ #include #include #include +#include #include "Common/CommonTypes.h" @@ -27,5 +28,5 @@ using MACAddress = std::array; MACAddress GenerateMacAddress(MACConsumer type); std::string MacAddressToString(const MACAddress& mac); -std::optional StringToMacAddress(const std::string& mac_string); +std::optional StringToMacAddress(std::string_view mac_string); } // namespace Common