Simplify, memset() with 0 rather than '\0'

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-10-24 10:44:47 +02:00
parent 6c23333feb
commit 773ee73214
3 changed files with 5 additions and 5 deletions

View File

@ -826,7 +826,7 @@ static void LogKernelLine(void)
* which will contain old messages. Then read the kernel log * which will contain old messages. Then read the kernel log
* messages into this fresh buffer. * 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 ((rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer) - 1)) < 0) {
if (errno == EINTR) if (errno == EINTR)
return; return;
@ -849,7 +849,7 @@ static void LogProcLine(void)
* which will contain old messages. Then read the kernel messages * which will contain old messages. Then read the kernel messages
* from the message pseudo-file into this fresh buffer. * 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 ((rdcnt = read(kmsg, log_buffer, sizeof(log_buffer) - 1)) < 0) {
if (errno == EINTR) if (errno == EINTR)
return; return;

View File

@ -804,7 +804,7 @@ int main(int argc, char *argv[])
fgets(line, sizeof(line), stdin); fgets(line, sizeof(line), stdin);
if (line[strlen(line) - 1] == '\n') if (line[strlen(line) - 1] == '\n')
line[strlen(line) - 1] = '\0'; /* Trash NL char */ line[strlen(line) - 1] = '\0'; /* Trash NL char */
memset(eline, '\0', sizeof(eline)); memset(eline, 0, sizeof(eline));
ExpandKadds(line, eline); ExpandKadds(line, eline);
fprintf(stdout, "%s\n", eline); fprintf(stdout, "%s\n", eline);
} }

View File

@ -1243,7 +1243,7 @@ int main(int argc, char *argv[])
#else #else
if (FD_ISSET(fileno(stdin), &readfds)) { if (FD_ISSET(fileno(stdin), &readfds)) {
logit("Message from stdin.\n"); logit("Message from stdin.\n");
memset(line, '\0', sizeof(line)); memset(line, 0, sizeof(line));
line[0] = '.'; line[0] = '.';
parts[fileno(stdin)] = NULL; parts[fileno(stdin)] = NULL;
i = read(fileno(stdin), line, MAXLINE); i = read(fileno(stdin), line, MAXLINE);
@ -1535,7 +1535,7 @@ void printchopped(const char *hname, char *msg, size_t len, int fd)
else { else {
strcpy(parts[fd], p); strcpy(parts[fd], p);
logit("Saving partial msg: %s\n", parts[fd]); logit("Saving partial msg: %s\n", parts[fd]);
memset(p, '\0', ptlngth); memset(p, 0, ptlngth);
} }
} }