Unify GetHostname() and use libuv implementation (#1391)

This commit is contained in:
Peter Johnson
2018-10-28 19:01:48 -07:00
committed by GitHub
parent a8aacd3657
commit 9a1af132bf
6 changed files with 37 additions and 54 deletions

View File

@@ -8,6 +8,7 @@
#include "cscore_cpp.h"
#include <wpi/SmallString.h>
#include <wpi/hostname.h>
#include "Handle.h"
#include "Log.h"
@@ -686,4 +687,6 @@ wpi::ArrayRef<CS_Sink> EnumerateSinkHandles(wpi::SmallVectorImpl<CS_Sink>& vec,
return Sinks::GetInstance().GetAll(vec);
}
std::string GetHostname() { return wpi::GetHostname(); }
} // namespace cs

View File

@@ -14,13 +14,6 @@
namespace cs {
std::string GetHostname() {
char name[256];
if (::gethostname(name, sizeof(name)) != 0) return "";
name[255] = '\0'; // Per POSIX, may not be null terminated if too long
return name;
}
std::vector<std::string> GetNetworkInterfaces() {
struct ifaddrs* ifa;
if (::getifaddrs(&ifa) != 0) return std::vector<std::string>{};

View File

@@ -9,10 +9,6 @@
namespace cs {
std::string GetHostname() {
return ""; // TODO
}
std::vector<std::string> GetNetworkInterfaces() {
return std::vector<std::string>{}; // TODO
}

View File

@@ -9,10 +9,6 @@
namespace cs {
std::string GetHostname() {
return ""; // TODO
}
std::vector<std::string> GetNetworkInterfaces() {
return std::vector<std::string>{}; // TODO
}