From db362e2e23fe631182d1aefcd314c143dd9aa8a1 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Thu, 28 Dec 2017 09:42:04 +0100 Subject: [PATCH] Remove redundant assignments --- common/wireaddr.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/common/wireaddr.c b/common/wireaddr.c index 7aa2119c8..c543b1cba 100644 --- a/common/wireaddr.c +++ b/common/wireaddr.c @@ -107,18 +107,12 @@ bool parse_wireaddr(const char *arg, struct wireaddr *addr, u16 defport) // NOTE: arg is assumed to be an ipv4/6 addr string with optional port bool parse_ip_port(tal_t *ctx, const char *arg, char **ip, u16 *port) { - bool ipv6, has_brackets, has_colon; - *port = 0; - ipv6 = true; - has_brackets = false; - has_colon = false; - *ip = tal_strdup(ctx, arg); - ipv6 = strchr(*ip, '.') == NULL; - has_brackets = strchr(*ip, '['); - has_colon = strchr(*ip, ':'); + bool ipv6 = strchr(*ip, '.') == NULL; + bool has_brackets = strchr(*ip, '['); + bool has_colon = strchr(*ip, ':'); // we have an ip addr with no port if ((ipv6 && !has_brackets) || (!ipv6 && !has_colon))