mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Unify GetHostname() and use libuv implementation (#1391)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>{};
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
|
||||
namespace cs {
|
||||
|
||||
std::string GetHostname() {
|
||||
return ""; // TODO
|
||||
}
|
||||
|
||||
std::vector<std::string> GetNetworkInterfaces() {
|
||||
return std::vector<std::string>{}; // TODO
|
||||
}
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
|
||||
namespace cs {
|
||||
|
||||
std::string GetHostname() {
|
||||
return ""; // TODO
|
||||
}
|
||||
|
||||
std::vector<std::string> GetNetworkInterfaces() {
|
||||
return std::vector<std::string>{}; // TODO
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user