diff options
author | pfg <pfg@FreeBSD.org> | 2016-04-10 23:47:40 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-04-10 23:47:40 +0000 |
commit | d2d72fe957c58fe44c5f184f8a84dd8d2cea6db8 (patch) | |
tree | f95cdb40ea4bc3d4c266362594d42a6fb6ee3932 | |
parent | ce50ae85600dfc2edaa4815cdc55e178003f3249 (diff) | |
download | FreeBSD-src-d2d72fe957c58fe44c5f184f8a84dd8d2cea6db8.zip FreeBSD-src-d2d72fe957c58fe44c5f184f8a84dd8d2cea6db8.tar.gz |
lpr: replace 0 with NULL for pointers.
Found with devel/coccinelle.
Reviewed by: gad
-rw-r--r-- | usr.sbin/lpr/chkprintcap/chkprintcap.c | 8 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/common.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/net.c | 2 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/printcap.c | 8 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/request.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/rmjob.c | 2 | ||||
-rw-r--r-- | usr.sbin/lpr/lpc/lpc.c | 12 | ||||
-rw-r--r-- | usr.sbin/lpr/lpd/printjob.c | 6 |
8 files changed, 23 insertions, 23 deletions
diff --git a/usr.sbin/lpr/chkprintcap/chkprintcap.c b/usr.sbin/lpr/chkprintcap/chkprintcap.c index 91e8299..96fe489 100644 --- a/usr.sbin/lpr/chkprintcap/chkprintcap.c +++ b/usr.sbin/lpr/chkprintcap/chkprintcap.c @@ -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) { diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index 52d6c9f..ce0ba7c 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -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; diff --git a/usr.sbin/lpr/common_source/net.c b/usr.sbin/lpr/common_source/net.c index ab6fa16..c495bbb 100644 --- a/usr.sbin/lpr/common_source/net.c +++ b/usr.sbin/lpr/common_source/net.c @@ -280,7 +280,7 @@ writel(int strm, ...) if (n > NIOV) { iovp = malloc(n * sizeof *iovp); - if (iovp == 0) + if (iovp == NULL) return -1; } diff --git a/usr.sbin/lpr/common_source/printcap.c b/usr.sbin/lpr/common_source/printcap.c index 0d3644b..707b7b8 100644 --- a/usr.sbin/lpr/common_source/printcap.c +++ b/usr.sbin/lpr/common_source/printcap.c @@ -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); } diff --git a/usr.sbin/lpr/common_source/request.c b/usr.sbin/lpr/common_source/request.c index b650e5c..0c68fe9 100644 --- a/usr.sbin/lpr/common_source/request.c +++ b/usr.sbin/lpr/common_source/request.c @@ -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); } diff --git a/usr.sbin/lpr/common_source/rmjob.c b/usr.sbin/lpr/common_source/rmjob.c index c89a6f0..96f20be 100644 --- a/usr.sbin/lpr/common_source/rmjob.c +++ b/usr.sbin/lpr/common_source/rmjob.c @@ -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; diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c index cc58bd9..5b5ec78 100644 --- a/usr.sbin/lpr/lpc/lpc.c +++ b/usr.sbin/lpr/lpc/lpc.c @@ -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")) diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 06ea1b0..b388b96 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -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); } |