From 4782d92b2d4fab261b5520a29d79ba97fea9ce7b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 10 Nov 2017 09:53:21 -0800 Subject: s/NULL/nullptr --- src/core/lib/support/host_port.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/core/lib/support/host_port.cc') diff --git a/src/core/lib/support/host_port.cc b/src/core/lib/support/host_port.cc index 1927d5507d..cb8e3d4479 100644 --- a/src/core/lib/support/host_port.cc +++ b/src/core/lib/support/host_port.cc @@ -26,7 +26,7 @@ #include "src/core/lib/support/string.h" int gpr_join_host_port(char** out, const char* host, int port) { - if (host[0] != '[' && strchr(host, ':') != NULL) { + if (host[0] != '[' && strchr(host, ':') != nullptr) { /* IPv6 literals must be enclosed in brackets. */ return gpr_asprintf(out, "[%s]:%d", host, port); } else { @@ -40,19 +40,19 @@ int gpr_split_host_port(const char* name, char** host, char** port) { size_t host_len; const char* port_start; - *host = NULL; - *port = NULL; + *host = nullptr; + *port = nullptr; if (name[0] == '[') { /* Parse a bracketed host, typically an IPv6 literal. */ const char* rbracket = strchr(name, ']'); - if (rbracket == NULL) { + if (rbracket == nullptr) { /* Unmatched [ */ return 0; } if (rbracket[1] == '\0') { /* ] */ - port_start = NULL; + port_start = nullptr; } else if (rbracket[1] == ':') { /* ]: */ port_start = rbracket + 2; @@ -62,14 +62,14 @@ int gpr_split_host_port(const char* name, char** host, char** port) { } host_start = name + 1; host_len = (size_t)(rbracket - host_start); - if (memchr(host_start, ':', host_len) == NULL) { + if (memchr(host_start, ':', host_len) == nullptr) { /* Require all bracketed hosts to contain a colon, because a hostname or IPv4 address should never use brackets. */ return 0; } } else { const char* colon = strchr(name, ':'); - if (colon != NULL && strchr(colon + 1, ':') == NULL) { + if (colon != nullptr && strchr(colon + 1, ':') == nullptr) { /* Exactly 1 colon. Split into host:port. */ host_start = name; host_len = (size_t)(colon - name); @@ -78,7 +78,7 @@ int gpr_split_host_port(const char* name, char** host, char** port) { /* 0 or 2+ colons. Bare hostname or IPv6 litearal. */ host_start = name; host_len = strlen(name); - port_start = NULL; + port_start = nullptr; } } @@ -87,7 +87,7 @@ int gpr_split_host_port(const char* name, char** host, char** port) { memcpy(*host, host_start, host_len); (*host)[host_len] = '\0'; - if (port_start != NULL) { + if (port_start != nullptr) { *port = gpr_strdup(port_start); } -- cgit v1.2.3