mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
Remove redundant assignments
This commit is contained in:
committed by
Rusty Russell
parent
280c0e53ef
commit
db362e2e23
@@ -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
|
// 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 parse_ip_port(tal_t *ctx, const char *arg, char **ip, u16 *port) {
|
||||||
bool ipv6, has_brackets, has_colon;
|
|
||||||
|
|
||||||
*port = 0;
|
*port = 0;
|
||||||
ipv6 = true;
|
|
||||||
has_brackets = false;
|
|
||||||
has_colon = false;
|
|
||||||
|
|
||||||
*ip = tal_strdup(ctx, arg);
|
*ip = tal_strdup(ctx, arg);
|
||||||
|
|
||||||
ipv6 = strchr(*ip, '.') == NULL;
|
bool ipv6 = strchr(*ip, '.') == NULL;
|
||||||
has_brackets = strchr(*ip, '[');
|
bool has_brackets = strchr(*ip, '[');
|
||||||
has_colon = strchr(*ip, ':');
|
bool has_colon = strchr(*ip, ':');
|
||||||
|
|
||||||
// we have an ip addr with no port
|
// we have an ip addr with no port
|
||||||
if ((ipv6 && !has_brackets) || (!ipv6 && !has_colon))
|
if ((ipv6 && !has_brackets) || (!ipv6 && !has_colon))
|
||||||
|
|||||||
Reference in New Issue
Block a user