From 773ee73214bd3d390c3f548d99e1908d9b31a0a5 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 24 Oct 2019 10:44:47 +0200 Subject: [PATCH] Simplify, memset() with 0 rather than '\0' Signed-off-by: Joachim Nilsson --- src/klogd.c | 4 ++-- src/ksym.c | 2 +- src/syslogd.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/klogd.c b/src/klogd.c index 8b087b0..8c669a9 100644 --- a/src/klogd.c +++ b/src/klogd.c @@ -826,7 +826,7 @@ static void LogKernelLine(void) * which will contain old messages. Then read the kernel log * messages into this fresh buffer. */ - memset(log_buffer, '\0', sizeof(log_buffer)); + memset(log_buffer, 0, sizeof(log_buffer)); if ((rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer) - 1)) < 0) { if (errno == EINTR) return; @@ -849,7 +849,7 @@ static void LogProcLine(void) * which will contain old messages. Then read the kernel messages * from the message pseudo-file into this fresh buffer. */ - memset(log_buffer, '\0', sizeof(log_buffer)); + memset(log_buffer, 0, sizeof(log_buffer)); if ((rdcnt = read(kmsg, log_buffer, sizeof(log_buffer) - 1)) < 0) { if (errno == EINTR) return; diff --git a/src/ksym.c b/src/ksym.c index 7f7483e..bd12372 100644 --- a/src/ksym.c +++ b/src/ksym.c @@ -804,7 +804,7 @@ int main(int argc, char *argv[]) fgets(line, sizeof(line), stdin); if (line[strlen(line) - 1] == '\n') line[strlen(line) - 1] = '\0'; /* Trash NL char */ - memset(eline, '\0', sizeof(eline)); + memset(eline, 0, sizeof(eline)); ExpandKadds(line, eline); fprintf(stdout, "%s\n", eline); } diff --git a/src/syslogd.c b/src/syslogd.c index c9bca25..9054af5 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -1243,7 +1243,7 @@ int main(int argc, char *argv[]) #else if (FD_ISSET(fileno(stdin), &readfds)) { logit("Message from stdin.\n"); - memset(line, '\0', sizeof(line)); + memset(line, 0, sizeof(line)); line[0] = '.'; parts[fileno(stdin)] = NULL; i = read(fileno(stdin), line, MAXLINE); @@ -1535,7 +1535,7 @@ void printchopped(const char *hname, char *msg, size_t len, int fd) else { strcpy(parts[fd], p); logit("Saving partial msg: %s\n", parts[fd]); - memset(p, '\0', ptlngth); + memset(p, 0, ptlngth); } }