Commit 664fc76a authored by Max Kellermann's avatar Max Kellermann

system/Resolver: use nullptr instead of NULL

parent 37d6cc07
...@@ -85,7 +85,7 @@ sockaddr_to_string(const struct sockaddr *sa, size_t length) ...@@ -85,7 +85,7 @@ sockaddr_to_string(const struct sockaddr *sa, size_t length)
return "unknown"; return "unknown";
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
if (strchr(host, ':') != NULL) { if (strchr(host, ':') != nullptr) {
std::string result("["); std::string result("[");
result.append(host); result.append(host);
result.append("]:"); result.append("]:");
...@@ -121,7 +121,7 @@ resolve_host_port(const char *host_port, unsigned default_port, ...@@ -121,7 +121,7 @@ resolve_host_port(const char *host_port, unsigned default_port,
} }
} }
if (port == NULL) { if (port == nullptr) {
/* port is after the colon, but only if it's the only /* port is after the colon, but only if it's the only
colon (don't split IPv6 addresses) */ colon (don't split IPv6 addresses) */
...@@ -134,13 +134,13 @@ resolve_host_port(const char *host_port, unsigned default_port, ...@@ -134,13 +134,13 @@ resolve_host_port(const char *host_port, unsigned default_port,
} }
char buffer[32]; char buffer[32];
if (port == NULL && default_port != 0) { if (port == nullptr && default_port != 0) {
snprintf(buffer, sizeof(buffer), "%u", default_port); snprintf(buffer, sizeof(buffer), "%u", default_port);
port = buffer; port = buffer;
} }
if ((flags & AI_PASSIVE) != 0 && strcmp(host, "*") == 0) if ((flags & AI_PASSIVE) != 0 && strcmp(host, "*") == 0)
host = NULL; host = nullptr;
addrinfo hints; addrinfo hints;
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
...@@ -154,7 +154,7 @@ resolve_host_port(const char *host_port, unsigned default_port, ...@@ -154,7 +154,7 @@ resolve_host_port(const char *host_port, unsigned default_port,
error.Format(resolver_domain, ret, error.Format(resolver_domain, ret,
"Failed to look up '%s': %s", "Failed to look up '%s': %s",
host_port, gai_strerror(ret)); host_port, gai_strerror(ret));
return NULL; return nullptr;
} }
return ai; return ai;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment