diff options
Diffstat (limited to 'drivers/unix/ip_unix.cpp')
-rw-r--r-- | drivers/unix/ip_unix.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index 08c099f771..5e3dedfc2f 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -107,13 +107,13 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) { }; hints.ai_flags &= ~AI_NUMERICHOST; - int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result); + int s = getaddrinfo(p_hostname.utf8().get_data(), nullptr, &hints, &result); if (s != 0) { ERR_PRINT("getaddrinfo failed! Cannot resolve hostname."); return IP_Address(); }; - if (result == NULL || result->ai_addr == NULL) { + if (result == nullptr || result->ai_addr == nullptr) { ERR_PRINT("Invalid response from getaddrinfo"); if (result) freeaddrinfo(result); @@ -175,7 +175,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co addrs = (IP_ADAPTER_ADDRESSES *)memalloc(buf_size); int err = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME, - NULL, addrs, &buf_size); + nullptr, addrs, &buf_size); if (err == NO_ERROR) { break; }; @@ -189,7 +189,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co IP_ADAPTER_ADDRESSES *adapter = addrs; - while (adapter != NULL) { + while (adapter != nullptr) { Interface_Info info; info.name = adapter->AdapterName; @@ -197,7 +197,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co info.index = String::num_uint64(adapter->IfIndex); IP_ADAPTER_UNICAST_ADDRESS *address = adapter->FirstUnicastAddress; - while (address != NULL) { + while (address != nullptr) { int family = address->Address.lpSockaddr->sa_family; if (family != AF_INET && family != AF_INET6) continue; @@ -219,13 +219,13 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const { - struct ifaddrs *ifAddrStruct = NULL; - struct ifaddrs *ifa = NULL; + struct ifaddrs *ifAddrStruct = nullptr; + struct ifaddrs *ifa = nullptr; int family; getifaddrs(&ifAddrStruct); - for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) { + for (ifa = ifAddrStruct; ifa != nullptr; ifa = ifa->ifa_next) { if (!ifa->ifa_addr) continue; @@ -248,7 +248,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co info.ip_addresses.push_front(_sockaddr2ip(ifa->ifa_addr)); } - if (ifAddrStruct != NULL) freeifaddrs(ifAddrStruct); + if (ifAddrStruct != nullptr) freeifaddrs(ifAddrStruct); } #endif |