Update clang-format to 5.0
diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc
index 8a2e6ed..2dbc5aa 100644
--- a/src/core/lib/iomgr/sockaddr_utils.cc
+++ b/src/core/lib/iomgr/sockaddr_utils.cc
@@ -36,16 +36,16 @@
static const uint8_t kV4MappedPrefix[] = {0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0xff, 0xff};
-int grpc_sockaddr_is_v4mapped(const grpc_resolved_address *resolved_addr,
- grpc_resolved_address *resolved_addr4_out) {
+int grpc_sockaddr_is_v4mapped(const grpc_resolved_address* resolved_addr,
+ grpc_resolved_address* resolved_addr4_out) {
GPR_ASSERT(resolved_addr != resolved_addr4_out);
- const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr;
- struct sockaddr_in *addr4_out =
+ const struct sockaddr* addr = (const struct sockaddr*)resolved_addr->addr;
+ struct sockaddr_in* addr4_out =
resolved_addr4_out == NULL
? NULL
- : (struct sockaddr_in *)resolved_addr4_out->addr;
+ : (struct sockaddr_in*)resolved_addr4_out->addr;
if (addr->sa_family == AF_INET6) {
- const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr;
+ const struct sockaddr_in6* addr6 = (const struct sockaddr_in6*)addr;
if (memcmp(addr6->sin6_addr.s6_addr, kV4MappedPrefix,
sizeof(kV4MappedPrefix)) == 0) {
if (resolved_addr4_out != NULL) {
@@ -63,14 +63,14 @@
return 0;
}
-int grpc_sockaddr_to_v4mapped(const grpc_resolved_address *resolved_addr,
- grpc_resolved_address *resolved_addr6_out) {
+int grpc_sockaddr_to_v4mapped(const grpc_resolved_address* resolved_addr,
+ grpc_resolved_address* resolved_addr6_out) {
GPR_ASSERT(resolved_addr != resolved_addr6_out);
- const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr;
- struct sockaddr_in6 *addr6_out =
- (struct sockaddr_in6 *)resolved_addr6_out->addr;
+ const struct sockaddr* addr = (const struct sockaddr*)resolved_addr->addr;
+ struct sockaddr_in6* addr6_out =
+ (struct sockaddr_in6*)resolved_addr6_out->addr;
if (addr->sa_family == AF_INET) {
- const struct sockaddr_in *addr4 = (const struct sockaddr_in *)addr;
+ const struct sockaddr_in* addr4 = (const struct sockaddr_in*)addr;
memset(resolved_addr6_out, 0, sizeof(*resolved_addr6_out));
addr6_out->sin6_family = AF_INET6;
memcpy(&addr6_out->sin6_addr.s6_addr[0], kV4MappedPrefix, 12);
@@ -82,17 +82,17 @@
return 0;
}
-int grpc_sockaddr_is_wildcard(const grpc_resolved_address *resolved_addr,
- int *port_out) {
- const struct sockaddr *addr;
+int grpc_sockaddr_is_wildcard(const grpc_resolved_address* resolved_addr,
+ int* port_out) {
+ const struct sockaddr* addr;
grpc_resolved_address addr4_normalized;
if (grpc_sockaddr_is_v4mapped(resolved_addr, &addr4_normalized)) {
resolved_addr = &addr4_normalized;
}
- addr = (const struct sockaddr *)resolved_addr->addr;
+ addr = (const struct sockaddr*)resolved_addr->addr;
if (addr->sa_family == AF_INET) {
/* Check for 0.0.0.0 */
- const struct sockaddr_in *addr4 = (const struct sockaddr_in *)addr;
+ const struct sockaddr_in* addr4 = (const struct sockaddr_in*)addr;
if (addr4->sin_addr.s_addr != 0) {
return 0;
}
@@ -100,7 +100,7 @@
return 1;
} else if (addr->sa_family == AF_INET6) {
/* Check for :: */
- const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr;
+ const struct sockaddr_in6* addr6 = (const struct sockaddr_in6*)addr;
int i;
for (i = 0; i < 16; i++) {
if (addr6->sin6_addr.s6_addr[i] != 0) {
@@ -114,15 +114,15 @@
}
}
-void grpc_sockaddr_make_wildcards(int port, grpc_resolved_address *wild4_out,
- grpc_resolved_address *wild6_out) {
+void grpc_sockaddr_make_wildcards(int port, grpc_resolved_address* wild4_out,
+ grpc_resolved_address* wild6_out) {
grpc_sockaddr_make_wildcard4(port, wild4_out);
grpc_sockaddr_make_wildcard6(port, wild6_out);
}
void grpc_sockaddr_make_wildcard4(int port,
- grpc_resolved_address *resolved_wild_out) {
- struct sockaddr_in *wild_out = (struct sockaddr_in *)resolved_wild_out->addr;
+ grpc_resolved_address* resolved_wild_out) {
+ struct sockaddr_in* wild_out = (struct sockaddr_in*)resolved_wild_out->addr;
GPR_ASSERT(port >= 0 && port < 65536);
memset(resolved_wild_out, 0, sizeof(*resolved_wild_out));
wild_out->sin_family = AF_INET;
@@ -131,9 +131,8 @@
}
void grpc_sockaddr_make_wildcard6(int port,
- grpc_resolved_address *resolved_wild_out) {
- struct sockaddr_in6 *wild_out =
- (struct sockaddr_in6 *)resolved_wild_out->addr;
+ grpc_resolved_address* resolved_wild_out) {
+ struct sockaddr_in6* wild_out = (struct sockaddr_in6*)resolved_wild_out->addr;
GPR_ASSERT(port >= 0 && port < 65536);
memset(resolved_wild_out, 0, sizeof(*resolved_wild_out));
wild_out->sin6_family = AF_INET6;
@@ -141,14 +140,14 @@
resolved_wild_out->len = sizeof(struct sockaddr_in6);
}
-int grpc_sockaddr_to_string(char **out,
- const grpc_resolved_address *resolved_addr,
+int grpc_sockaddr_to_string(char** out,
+ const grpc_resolved_address* resolved_addr,
int normalize) {
- const struct sockaddr *addr;
+ const struct sockaddr* addr;
const int save_errno = errno;
grpc_resolved_address addr_normalized;
char ntop_buf[INET6_ADDRSTRLEN];
- const void *ip = NULL;
+ const void* ip = NULL;
int port;
uint32_t sin6_scope_id = 0;
int ret;
@@ -157,13 +156,13 @@
if (normalize && grpc_sockaddr_is_v4mapped(resolved_addr, &addr_normalized)) {
resolved_addr = &addr_normalized;
}
- addr = (const struct sockaddr *)resolved_addr->addr;
+ addr = (const struct sockaddr*)resolved_addr->addr;
if (addr->sa_family == AF_INET) {
- const struct sockaddr_in *addr4 = (const struct sockaddr_in *)addr;
+ const struct sockaddr_in* addr4 = (const struct sockaddr_in*)addr;
ip = &addr4->sin_addr;
port = ntohs(addr4->sin_port);
} else if (addr->sa_family == AF_INET6) {
- const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr;
+ const struct sockaddr_in6* addr6 = (const struct sockaddr_in6*)addr;
ip = &addr6->sin6_addr;
port = ntohs(addr6->sin6_port);
sin6_scope_id = addr6->sin6_scope_id;
@@ -171,7 +170,7 @@
if (ip != NULL &&
grpc_inet_ntop(addr->sa_family, ip, ntop_buf, sizeof(ntop_buf)) != NULL) {
if (sin6_scope_id != 0) {
- char *host_with_scope;
+ char* host_with_scope;
/* Enclose sin6_scope_id with the format defined in RFC 6784 section 2. */
gpr_asprintf(&host_with_scope, "%s%%25%" PRIu32, ntop_buf, sin6_scope_id);
ret = gpr_join_host_port(out, host_with_scope, port);
@@ -187,17 +186,17 @@
return ret;
}
-char *grpc_sockaddr_to_uri(const grpc_resolved_address *resolved_addr) {
+char* grpc_sockaddr_to_uri(const grpc_resolved_address* resolved_addr) {
grpc_resolved_address addr_normalized;
if (grpc_sockaddr_is_v4mapped(resolved_addr, &addr_normalized)) {
resolved_addr = &addr_normalized;
}
- const char *scheme = grpc_sockaddr_get_uri_scheme(resolved_addr);
+ const char* scheme = grpc_sockaddr_get_uri_scheme(resolved_addr);
if (scheme == NULL || strcmp("unix", scheme) == 0) {
return grpc_sockaddr_to_uri_unix_if_possible(resolved_addr);
}
- char *path = NULL;
- char *uri_str = NULL;
+ char* path = NULL;
+ char* uri_str = NULL;
if (grpc_sockaddr_to_string(&path, resolved_addr,
false /* suppress errors */) &&
scheme != NULL) {
@@ -207,9 +206,9 @@
return uri_str != NULL ? uri_str : NULL;
}
-const char *grpc_sockaddr_get_uri_scheme(
- const grpc_resolved_address *resolved_addr) {
- const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr;
+const char* grpc_sockaddr_get_uri_scheme(
+ const grpc_resolved_address* resolved_addr) {
+ const struct sockaddr* addr = (const struct sockaddr*)resolved_addr->addr;
switch (addr->sa_family) {
case AF_INET:
return "ipv4";
@@ -221,18 +220,18 @@
return NULL;
}
-int grpc_sockaddr_get_family(const grpc_resolved_address *resolved_addr) {
- const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr;
+int grpc_sockaddr_get_family(const grpc_resolved_address* resolved_addr) {
+ const struct sockaddr* addr = (const struct sockaddr*)resolved_addr->addr;
return addr->sa_family;
}
-int grpc_sockaddr_get_port(const grpc_resolved_address *resolved_addr) {
- const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr;
+int grpc_sockaddr_get_port(const grpc_resolved_address* resolved_addr) {
+ const struct sockaddr* addr = (const struct sockaddr*)resolved_addr->addr;
switch (addr->sa_family) {
case AF_INET:
- return ntohs(((struct sockaddr_in *)addr)->sin_port);
+ return ntohs(((struct sockaddr_in*)addr)->sin_port);
case AF_INET6:
- return ntohs(((struct sockaddr_in6 *)addr)->sin6_port);
+ return ntohs(((struct sockaddr_in6*)addr)->sin6_port);
default:
if (grpc_is_unix_socket(resolved_addr)) {
return 1;
@@ -243,17 +242,17 @@
}
}
-int grpc_sockaddr_set_port(const grpc_resolved_address *resolved_addr,
+int grpc_sockaddr_set_port(const grpc_resolved_address* resolved_addr,
int port) {
- const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr;
+ const struct sockaddr* addr = (const struct sockaddr*)resolved_addr->addr;
switch (addr->sa_family) {
case AF_INET:
GPR_ASSERT(port >= 0 && port < 65536);
- ((struct sockaddr_in *)addr)->sin_port = htons((uint16_t)port);
+ ((struct sockaddr_in*)addr)->sin_port = htons((uint16_t)port);
return 1;
case AF_INET6:
GPR_ASSERT(port >= 0 && port < 65536);
- ((struct sockaddr_in6 *)addr)->sin6_port = htons((uint16_t)port);
+ ((struct sockaddr_in6*)addr)->sin6_port = htons((uint16_t)port);
return 1;
default:
gpr_log(GPR_ERROR, "Unknown socket family %d in grpc_sockaddr_set_port",