From 45be165f23108a8c0c5621c59ec1f23d6f9e8d35 Mon Sep 17 00:00:00 2001 From: Marcelo Araujo Date: Thu, 14 Apr 2016 12:46:46 +0000 Subject: [PATCH] Use NULL instead of 0 for pointers. The strchr(3) returns a NULL if the character does not appears in the string. The malloc will return NULL if cannot allocate memory. --- usr.sbin/fdread/fdread.c | 2 +- usr.sbin/fdread/fdutil.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/fdread/fdread.c b/usr.sbin/fdread/fdread.c index 770f92d36cb..f3c2d9147b9 100644 --- a/usr.sbin/fdread/fdread.c +++ b/usr.sbin/fdread/fdread.c @@ -170,7 +170,7 @@ doread(int fd, FILE *of, const char *_devname) secsize = 128 << fdt.secsize; tracksize = fdt.sectrac * secsize; mediasize = tracksize * fdt.tracks * fdt.heads; - if ((trackbuf = malloc(tracksize)) == 0) + if ((trackbuf = malloc(tracksize)) == NULL) errx(EX_TEMPFAIL, "out of memory"); if (!quiet) diff --git a/usr.sbin/fdread/fdutil.c b/usr.sbin/fdread/fdutil.c index c66b0c11bc0..bdd295aedf8 100644 --- a/usr.sbin/fdread/fdutil.c +++ b/usr.sbin/fdread/fdutil.c @@ -200,10 +200,10 @@ parse_fmt(const char *s, enum fd_drivetype type, *out = in; for (i = 0;; i++) { - if (s == 0) + if (s == NULL) break; - if ((cp = strchr(s, ',')) == 0) { + if ((cp = strchr(s, ',')) == NULL) { s1 = strdup(s); if (s1 == NULL) abort();