Adopt absl::string_view in rtc_base/ (straightforward cases)
Bug: webrtc:13579
Change-Id: I240db6285abb22652242bc0b2ebe9844ec4a45f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258723
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36561}
diff --git a/rtc_base/net_helpers.cc b/rtc_base/net_helpers.cc
index f521f0f..f092989 100644
--- a/rtc_base/net_helpers.cc
+++ b/rtc_base/net_helpers.cc
@@ -11,6 +11,9 @@
#include "rtc_base/net_helpers.h"
#include <memory>
+#include <string>
+
+#include "absl/strings/string_view.h"
#if defined(WEBRTC_WIN)
#include <ws2spi.h>
@@ -37,11 +40,12 @@
#endif
}
-int inet_pton(int af, const char* src, void* dst) {
+int inet_pton(int af, absl::string_view src, void* dst) {
+ std::string src_str = std::string(src);
#if defined(WEBRTC_WIN)
- return win32_inet_pton(af, src, dst);
+ return win32_inet_pton(af, src_str.c_str(), dst);
#else
- return ::inet_pton(af, src, dst);
+ return ::inet_pton(af, src_str.c_str(), dst);
#endif
}