lpr: replace 0 with NULL for pointers.
Found with devel/coccinelle. Reviewed by: gad
This commit is contained in:
parent
71c1e74434
commit
bc17d12da3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297795
@ -222,7 +222,7 @@ note_spool_dir(const struct printer *pp, const struct stat *st)
|
||||
struct dirlist *dp, *dp2, *last;
|
||||
|
||||
dp = malloc(sizeof *dp);
|
||||
if (dp == 0)
|
||||
if (dp == NULL)
|
||||
err(++problems, "malloc(%lu)", (u_long)sizeof *dp);
|
||||
|
||||
dp->stab = *st;
|
||||
@ -233,7 +233,7 @@ note_spool_dir(const struct printer *pp, const struct stat *st)
|
||||
if (dp->path == 0)
|
||||
err(++problems, "malloc(%lu)", strlen(pp->spool_dir) + 1UL);
|
||||
|
||||
last = 0;
|
||||
last = NULL;
|
||||
LIST_FOREACH(dp2, &dirlist, link) {
|
||||
if(!lessp(dp, dp2))
|
||||
break;
|
||||
@ -255,7 +255,7 @@ check_spool_dirs(void)
|
||||
for (dp = LIST_FIRST(&dirlist); dp; dp = dp2) {
|
||||
dp2 = LIST_NEXT(dp, link);
|
||||
|
||||
if (dp2 != 0 && equal(dp, dp2)) {
|
||||
if (dp2 != NULL && equal(dp, dp2)) {
|
||||
++problems;
|
||||
if (strcmp(dp->path, dp2->path) == 0) {
|
||||
warnx("%s and %s share the same spool, %s",
|
||||
@ -289,7 +289,7 @@ make_spool_dir(const struct printer *pp)
|
||||
return;
|
||||
}
|
||||
gr = getgrnam("daemon");
|
||||
if (gr == 0)
|
||||
if (gr == NULL)
|
||||
errx(++problems, "cannot locate daemon group");
|
||||
|
||||
if (chown(sd, pp->daemon_user, gr->gr_gid) < 0) {
|
||||
|
@ -282,7 +282,7 @@ lock_file_name(const struct printer *pp, char *buf, size_t len)
|
||||
{
|
||||
static char staticbuf[MAXPATHLEN];
|
||||
|
||||
if (buf == 0)
|
||||
if (buf == NULL)
|
||||
buf = staticbuf;
|
||||
if (len == 0)
|
||||
len = MAXPATHLEN;
|
||||
@ -300,7 +300,7 @@ status_file_name(const struct printer *pp, char *buf, size_t len)
|
||||
{
|
||||
static char staticbuf[MAXPATHLEN];
|
||||
|
||||
if (buf == 0)
|
||||
if (buf == NULL)
|
||||
buf = staticbuf;
|
||||
if (len == 0)
|
||||
len = MAXPATHLEN;
|
||||
|
@ -280,7 +280,7 @@ writel(int strm, ...)
|
||||
|
||||
if (n > NIOV) {
|
||||
iovp = malloc(n * sizeof *iovp);
|
||||
if (iovp == 0)
|
||||
if (iovp == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ getprintcap_int(char *bp, struct printer *pp)
|
||||
char *rp_name;
|
||||
int error;
|
||||
|
||||
if ((pp->printer = capdb_canonical_name(bp)) == 0)
|
||||
if ((pp->printer = capdb_canonical_name(bp)) == NULL)
|
||||
return PCAPERR_OSERR;
|
||||
|
||||
#define CHK(x) do {if ((x) == PCAPERR_OSERR) return PCAPERR_OSERR;}while(0)
|
||||
@ -386,7 +386,7 @@ capdb_getaltstr(char *bp, const char *shrt, const char *lng,
|
||||
return status;
|
||||
if (dflt) {
|
||||
*result = strdup(dflt);
|
||||
if (*result == 0)
|
||||
if (*result == NULL)
|
||||
return PCAPERR_OSERR;
|
||||
return strlen(*result);
|
||||
}
|
||||
@ -439,9 +439,9 @@ capdb_canonical_name(const char *bp)
|
||||
const char *nameend;
|
||||
|
||||
nameend = strpbrk(bp, "|:");
|
||||
if (nameend == 0)
|
||||
if (nameend == NULL)
|
||||
nameend = bp + 1;
|
||||
if ((retval = malloc(nameend - bp + 1)) != 0) {
|
||||
if ((retval = malloc(nameend - bp + 1)) != NULL) {
|
||||
retval[0] = '\0';
|
||||
strncat(retval, bp, nameend - bp);
|
||||
}
|
||||
|
@ -69,11 +69,11 @@ free_request(struct request *rp)
|
||||
free(rp->prettyname);
|
||||
if (rp->authinfo)
|
||||
free(rp->authinfo);
|
||||
while ((ru = TAILQ_FIRST(&rp->users)) != 0) {
|
||||
while ((ru = TAILQ_FIRST(&rp->users)) != NULL) {
|
||||
TAILQ_REMOVE(&rp->users, ru, ru_link);
|
||||
free(ru);
|
||||
}
|
||||
while ((rj = TAILQ_FIRST(&rp->jobids)) != 0) {
|
||||
while ((rj = TAILQ_FIRST(&rp->jobids)) != NULL) {
|
||||
TAILQ_REMOVE(&rp->jobids, rj, rj_link);
|
||||
free(rj);
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ rmremote(const struct printer *pp)
|
||||
else
|
||||
niov = 4 + requests + 1;
|
||||
iov = malloc(niov * sizeof *iov);
|
||||
if (iov == 0)
|
||||
if (iov == NULL)
|
||||
fatal(pp, "out of memory in rmremote()");
|
||||
iov[0].iov_base = "\5";
|
||||
iov[1].iov_base = pp->remote_queue;
|
||||
|
@ -103,7 +103,7 @@ main(int argc, char *argv[])
|
||||
printf("?Ambiguous command\n");
|
||||
exit(1);
|
||||
}
|
||||
if (c == 0) {
|
||||
if (c == NULL) {
|
||||
printf("?Invalid command\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -112,7 +112,7 @@ main(int argc, char *argv[])
|
||||
printf("?Privileged command\n");
|
||||
exit(1);
|
||||
}
|
||||
if (c->c_generic != 0)
|
||||
if (c->c_generic != NULL)
|
||||
generic(c->c_generic, c->c_opts, c->c_handler,
|
||||
argc, argv);
|
||||
else
|
||||
@ -205,7 +205,7 @@ cmdscanner(void)
|
||||
printf("?Ambiguous command\n");
|
||||
continue;
|
||||
}
|
||||
if (c == 0) {
|
||||
if (c == NULL) {
|
||||
printf("?Invalid command\n");
|
||||
continue;
|
||||
}
|
||||
@ -222,7 +222,7 @@ cmdscanner(void)
|
||||
* routine might also be set on a generic routine for
|
||||
* initial parameter processing.
|
||||
*/
|
||||
if (c->c_generic != 0)
|
||||
if (c->c_generic != NULL)
|
||||
generic(c->c_generic, c->c_opts, c->c_handler,
|
||||
margc, margv);
|
||||
else
|
||||
@ -239,7 +239,7 @@ getcmd(const char *name)
|
||||
|
||||
longest = 0;
|
||||
nmatches = 0;
|
||||
found = 0;
|
||||
found = NULL;
|
||||
for (c = cmdtab; (p = c->c_name); c++) {
|
||||
for (q = name; *q == *p++; q++)
|
||||
if (*q == 0) /* exact match? */
|
||||
@ -283,7 +283,7 @@ makeargv(void)
|
||||
break;
|
||||
*cp++ = '\0';
|
||||
}
|
||||
*argp++ = 0;
|
||||
*argp++ = NULL;
|
||||
}
|
||||
|
||||
#define HELPINDENT (sizeof ("directory"))
|
||||
|
@ -673,7 +673,7 @@ print(struct printer *pp, int format, char *file)
|
||||
av[i++] = "-L";
|
||||
av[i++] = *locale ? locale : "C";
|
||||
av[i++] = "-F";
|
||||
av[i] = 0;
|
||||
av[i] = NULL;
|
||||
fo = ofd;
|
||||
goto start;
|
||||
}
|
||||
@ -795,7 +795,7 @@ print(struct printer *pp, int format, char *file)
|
||||
av[n++] = "-h";
|
||||
av[n++] = origin_host;
|
||||
av[n++] = pp->acct_file;
|
||||
av[n] = 0;
|
||||
av[n] = NULL;
|
||||
fo = pfd;
|
||||
if (of_pid > 0) { /* stop output filter */
|
||||
write(ofd, "\031\1", 2);
|
||||
@ -1737,7 +1737,7 @@ init(struct printer *pp)
|
||||
sprintf(&length[2], "%ld", pp->page_length);
|
||||
sprintf(&pxwidth[2], "%ld", pp->page_pwidth);
|
||||
sprintf(&pxlength[2], "%ld", pp->page_plength);
|
||||
if ((s = checkremote(pp)) != 0) {
|
||||
if ((s = checkremote(pp)) != NULL) {
|
||||
syslog(LOG_WARNING, "%s", s);
|
||||
free(s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user