[hackers] [ii] [PATCH] ii: Remove unnecessary explicit zeroing of variables

From: Tom Schwindl <schwindl_AT_posteo.de>
Date: Fri, 2 Sep 2022 13:07:15 +0000

---
 ii.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/ii.c b/ii.c
index 0856e8f010d3..520f75d1618a 100644
--- a/ii.c
+++ b/ii.c
_AT_@ -32,7 +32,7 @@ size_t strlcpy(char *, const char *, size_t);
 #define IRC_MSG_MAX       512 /* guaranteed to be <= than PIPE_BUF */
 #define PING_TIMEOUT      600
 
-enum { TOK_NICKSRV = 0, TOK_USER, TOK_CMD, TOK_CHAN, TOK_ARG, TOK_TEXT, TOK_LAST };
+enum { TOK_NICKSRV, TOK_USER, TOK_CMD, TOK_CHAN, TOK_ARG, TOK_TEXT, TOK_LAST };
 
 typedef struct Channel Channel;
 struct Channel {
_AT_@ -76,9 +76,9 @@ static int       udsopen(const char *);
 static void      usage(void);
 
 static int      isrunning = 1;
-static time_t   last_response = 0;
-static Channel *channels = NULL;
-static Channel *channelmaster = NULL;
+static time_t   last_response;
+static Channel *channels;
+static Channel *channelmaster;
 static char     nick[32];          /* active nickname at runtime */
 static char     _nick[32];         /* nickname at startup */
 static char     ircpath[PATH_MAX]; /* irc dir (-i) */
_AT_@ -106,7 +106,7 @@ usage(void)
 static void
 ewritestr(int fd, const char *s)
 {
-	size_t len, off = 0;
+	size_t len, off;
 	int w = -1;
 
 	len = strlen(s);
_AT_@ -405,7 +405,7 @@ isnumeric(const char *s)
 static size_t
 tokenize(char **result, size_t reslen, char *str, int delim)
 {
-	char *p = NULL, *n = NULL;
+	char *p, *n;
 	size_t i = 0;
 
 	for (n = str; *n == ' '; n++)
_AT_@ -433,7 +433,7 @@ tokenize(char **result, size_t reslen, char *str, int delim)
 static void
 channel_print(Channel *c, const char *buf)
 {
-	FILE *fp = NULL;
+	FILE *fp;
 	time_t t = time(NULL);
 
 	if (!(fp = fopen(c->outpath, "a")))
_AT_@ -454,7 +454,7 @@ proc_channels_privmsg(int ircfd, Channel *c, char *buf)
 static void
 proc_channels_input(int ircfd, Channel *c, char *buf)
 {
-	char *p = NULL;
+	char *p;
 	size_t buflen;
 
 	if (buf[0] == '\0')
_AT_@ -548,7 +548,7 @@ proc_server_cmd(int fd, char *buf)
 {
 	Channel *c;
 	const char *channel;
-	char *argv[TOK_LAST], *cmd = NULL, *p = NULL;
+	char *argv[TOK_LAST], *cmd, *p;
 	unsigned int i;
 
 	if (!buf || buf[0] == '\0')
_AT_@ -667,7 +667,7 @@ static int
 read_line(int fd, char *buf, size_t bufsiz)
 {
 	size_t i = 0;
-	char c = '\0';
+	char c;
 
 	do {
 		if (read(fd, &c, sizeof(char)) != sizeof(char))
-- 
2.37.2
Received on Fri Sep 02 2022 - 15:07:15 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 02 2022 - 15:12:35 CEST