summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Network.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2019-12-06 17:00:42 +0100
committerGitHub <noreply@github.com>2019-12-06 17:00:42 +0100
commit5a5c46a8b15990e1e38636d017c28572e4370745 (patch)
tree2354ff91dc919bf3110bf2351981666223bf1d1c /Source/Core/Common/Network.cpp
parent15fc71cfcf5f94221443aaff99ae559fa3cb4633 (diff)
parent81edcca8db0bbbe9904956d7038bd1a2abdd9a87 (diff)
Merge pull request #8514 from lioncash/sview
Common/Network: Make StringToMacAddress use a string_view
Diffstat (limited to 'Source/Core/Common/Network.cpp')
-rw-r--r--Source/Core/Common/Network.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp
index 77d835a126..a928e8e831 100644
--- a/Source/Core/Common/Network.cpp
+++ b/Source/Core/Common/Network.cpp
@@ -6,8 +6,6 @@
#include <algorithm>
#include <cctype>
-#include <cstring>
-#include <ctime>
#include <fmt/format.h>
@@ -43,10 +41,10 @@ std::string MacAddressToString(const MACAddress& mac)
mac[4], mac[5]);
}
-std::optional<MACAddress> StringToMacAddress(const std::string& mac_string)
+std::optional<MACAddress> StringToMacAddress(std::string_view mac_string)
{
if (mac_string.empty())
- return {};
+ return std::nullopt;
int x = 0;
MACAddress mac{};
@@ -70,7 +68,7 @@ std::optional<MACAddress> StringToMacAddress(const std::string& mac_string)
// nibble is a character in the MAC address, making 12 characters
// in total.
if (x / 2 != MAC_ADDRESS_SIZE)
- return {};
+ return std::nullopt;
return std::make_optional(mac);
}