util: fromString: Reduce string allocations
Change-Id: Ie6f7fa5dcc958081e7d7e2b880c17fe3548955a7
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/util.hpp b/src/util.hpp
index b1d27c4..804d492 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -44,7 +44,11 @@
* @returns A mac address in network byte order
* @throws std::runtime_error for bad mac
*/
-ether_addr fromString(std::string_view str);
+ether_addr fromString(const char* str);
+inline ether_addr fromString(const std::string& str)
+{
+ return fromString(str.c_str());
+}
/** @brief Converts the given mac address bytes into a string
* @param[in] mac - The mac address