Simplify, remove gratuitous 'return;' at end of functions + cleanup
- Add empty lines for readability, after return before new statement and after variable declarations - Remove explicit typecasting, NULL is NULL regardless of type - Remove unnecessary braces and else Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
773ee73214
commit
27027456b5
@ -830,6 +830,7 @@ static void LogKernelLine(void)
|
|||||||
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;
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"klogd: Error return from sys_sycall: %d - %s\n",
|
"klogd: Error return from sys_sycall: %d - %s\n",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
|
@ -776,7 +776,6 @@ char *ExpandKadds(char *line, char *el)
|
|||||||
void SetParanoiaLevel(int level)
|
void SetParanoiaLevel(int level)
|
||||||
{
|
{
|
||||||
i_am_paranoid = level;
|
i_am_paranoid = level;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -821,8 +820,6 @@ void Syslog(int priority, char *fmt, ...)
|
|||||||
vfprintf(stdout, fmt, ap);
|
vfprintf(stdout, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fputc('\n', stdout);
|
fputc('\n', stdout);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -285,7 +285,6 @@ static void FreeModules(void)
|
|||||||
free(sym_array_modules);
|
free(sym_array_modules);
|
||||||
sym_array_modules = NULL;
|
sym_array_modules = NULL;
|
||||||
num_modules = 0;
|
num_modules = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
@ -538,8 +537,6 @@ void Syslog(int priority, char *fmt, ...)
|
|||||||
vfprintf(stdout, fmt, ap);
|
vfprintf(stdout, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fputc('\n', stdout);
|
fputc('\n', stdout);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* TEST */
|
#endif /* TEST */
|
||||||
|
@ -1107,6 +1107,7 @@ int main(int argc, char *argv[])
|
|||||||
/* Main loop begins here. */
|
/* Main loop begins here. */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int nfds;
|
int nfds;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
maxfds = 0;
|
maxfds = 0;
|
||||||
@ -1156,8 +1157,8 @@ int main(int argc, char *argv[])
|
|||||||
logit("%d ", nfds);
|
logit("%d ", nfds);
|
||||||
logit("\n");
|
logit("\n");
|
||||||
}
|
}
|
||||||
nfds = select(maxfds + 1, (fd_set *)&readfds, (fd_set *)NULL,
|
|
||||||
(fd_set *)NULL, (struct timeval *)NULL);
|
nfds = select(maxfds + 1, &readfds, NULL, NULL, NULL);
|
||||||
if (restart) {
|
if (restart) {
|
||||||
restart = 0;
|
restart = 0;
|
||||||
logit("\nReceived SIGHUP, reloading syslogd.\n");
|
logit("\nReceived SIGHUP, reloading syslogd.\n");
|
||||||
@ -1173,6 +1174,7 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nfds == 0) {
|
if (nfds == 0) {
|
||||||
logit("No select activity.\n");
|
logit("No select activity.\n");
|
||||||
continue;
|
continue;
|
||||||
@ -1484,9 +1486,8 @@ char **crunch_list(list) char *list;
|
|||||||
|
|
||||||
void untty(void)
|
void untty(void)
|
||||||
{
|
{
|
||||||
if (!Debug) {
|
if (!Debug)
|
||||||
setsid();
|
setsid();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1518,8 +1519,8 @@ void printchopped(const char *hname, char *msg, size_t len, int fd)
|
|||||||
printline(hname, tmpline);
|
printline(hname, tmpline);
|
||||||
if ((strlen(msg) + 1) == len)
|
if ((strlen(msg) + 1) == len)
|
||||||
return;
|
return;
|
||||||
else
|
|
||||||
start = strchr(msg, '\0') + 1;
|
start = strchr(msg, '\0') + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1544,8 +1545,6 @@ void printchopped(const char *hname, char *msg, size_t len, int fd)
|
|||||||
printline(hname, start);
|
printline(hname, start);
|
||||||
start = end + 1;
|
start = end + 1;
|
||||||
} while (*start != '\0');
|
} while (*start != '\0');
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1600,7 +1599,6 @@ void printline(const char *hname, char *msg)
|
|||||||
*q = '\0';
|
*q = '\0';
|
||||||
|
|
||||||
logmsg(pri, line, hname, SYNC_FILE);
|
logmsg(pri, line, hname, SYNC_FILE);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1617,6 +1615,7 @@ void printsys(char *msg)
|
|||||||
for (p = msg; *p != '\0';) {
|
for (p = msg; *p != '\0';) {
|
||||||
flags = ADDDATE;
|
flags = ADDDATE;
|
||||||
pri = DEFSPRI;
|
pri = DEFSPRI;
|
||||||
|
|
||||||
if (*p == '<') {
|
if (*p == '<') {
|
||||||
pri = 0;
|
pri = 0;
|
||||||
while (isdigit(*++p))
|
while (isdigit(*++p))
|
||||||
@ -1627,8 +1626,10 @@ void printsys(char *msg)
|
|||||||
/* kernel printf's come out on console */
|
/* kernel printf's come out on console */
|
||||||
flags |= IGN_CONS;
|
flags |= IGN_CONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pri & ~(LOG_FACMASK | LOG_PRIMASK))
|
if (pri & ~(LOG_FACMASK | LOG_PRIMASK))
|
||||||
pri = DEFSPRI;
|
pri = DEFSPRI;
|
||||||
|
|
||||||
q = lp;
|
q = lp;
|
||||||
while (*p != '\0' && (c = *p++) != '\n' &&
|
while (*p != '\0' && (c = *p++) != '\n' &&
|
||||||
q < &line[MAXLINE])
|
q < &line[MAXLINE])
|
||||||
@ -1636,7 +1637,6 @@ void printsys(char *msg)
|
|||||||
*q = '\0';
|
*q = '\0';
|
||||||
logmsg(pri, line, LocalHostName, flags);
|
logmsg(pri, line, LocalHostName, flags);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2180,9 +2180,9 @@ void fprintlog(struct filed *f, char *from, int flags, char *msg)
|
|||||||
wallmsg(f, iov);
|
wallmsg(f, iov);
|
||||||
break;
|
break;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
|
|
||||||
if (f->f_type != F_FORW_UNKN)
|
if (f->f_type != F_FORW_UNKN)
|
||||||
f->f_prevcount = 0;
|
f->f_prevcount = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jmp_buf ttybuf;
|
jmp_buf ttybuf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user