From 3aa9734c1ca0a4b8fe498a04b3f9e9b418263a80 Mon Sep 17 00:00:00 2001 From: Emil Engler Date: Mon, 14 Aug 2023 12:01:31 +0200 Subject: [PATCH 1/2] core: remove unused len variable This commit removes the unused `len` variable, which gets set quite a few times, but whose value is totally unused. This also fixes a compiler warning I get on my Darwin. --- src/irc/core/netsplit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c index 38b63fe5..308a20d9 100644 --- a/src/irc/core/netsplit.c +++ b/src/irc/core/netsplit.c @@ -222,7 +222,7 @@ NETSPLIT_CHAN_REC *netsplit_find_channel(IRC_SERVER_REC *server, int quitmsg_is_split(const char *msg) { const char *host2, *p; - int prev, len, host1_dot, host2_dot; + int prev, host1_dot, host2_dot; g_return_val_if_fail(msg != NULL, FALSE); @@ -242,7 +242,7 @@ int quitmsg_is_split(const char *msg) - can't contain ':' or '/' chars (some servers allow URLs) */ host2 = NULL; - prev = '\0'; len = 0; host1_dot = host2_dot = 0; + prev = '\0'; host1_dot = host2_dot = 0; while (*msg != '\0') { if (*msg == ' ') { if (prev == '.' || prev == '\0') { @@ -254,7 +254,7 @@ int quitmsg_is_split(const char *msg) return FALSE; /* only one space allowed */ if (!host1_dot) return FALSE; /* host1 didn't have domain */ - host2 = msg+1; len = -1; + host2 = msg+1; } else if (*msg == '.') { if (prev == '\0' || prev == ' ' || prev == '.') { /* domains can't start with '.' @@ -270,7 +270,7 @@ int quitmsg_is_split(const char *msg) return FALSE; prev = *msg; - msg++; len++; + msg++; } if (!host2_dot || prev == '.') From fe6013be42b9af94de3bb0e497a3ab135af2fb8e Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 12 Sep 2023 13:51:36 +0200 Subject: [PATCH 2/2] improve code formatting --- src/irc/core/netsplit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c index 308a20d9..4a902c9e 100644 --- a/src/irc/core/netsplit.c +++ b/src/irc/core/netsplit.c @@ -222,7 +222,7 @@ NETSPLIT_CHAN_REC *netsplit_find_channel(IRC_SERVER_REC *server, int quitmsg_is_split(const char *msg) { const char *host2, *p; - int prev, host1_dot, host2_dot; + int prev, host1_dot, host2_dot; g_return_val_if_fail(msg != NULL, FALSE); @@ -242,7 +242,8 @@ int quitmsg_is_split(const char *msg) - can't contain ':' or '/' chars (some servers allow URLs) */ host2 = NULL; - prev = '\0'; host1_dot = host2_dot = 0; + prev = '\0'; + host1_dot = host2_dot = 0; while (*msg != '\0') { if (*msg == ' ') { if (prev == '.' || prev == '\0') { @@ -254,7 +255,7 @@ int quitmsg_is_split(const char *msg) return FALSE; /* only one space allowed */ if (!host1_dot) return FALSE; /* host1 didn't have domain */ - host2 = msg+1; + host2 = msg + 1; } else if (*msg == '.') { if (prev == '\0' || prev == ' ' || prev == '.') { /* domains can't start with '.' @@ -270,7 +271,7 @@ int quitmsg_is_split(const char *msg) return FALSE; prev = *msg; - msg++; + msg++; } if (!host2_dot || prev == '.')