svn commit: r297962 - head/usr.sbin/fdread
Marcelo Araujo
araujo at FreeBSD.org
Thu Apr 14 12:46:47 UTC 2016
Author: araujo
Date: Thu Apr 14 12:46:46 2016
New Revision: 297962
URL: https://svnweb.freebsd.org/changeset/base/297962
Log:
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.
Modified:
head/usr.sbin/fdread/fdread.c
head/usr.sbin/fdread/fdutil.c
Modified: head/usr.sbin/fdread/fdread.c
==============================================================================
--- head/usr.sbin/fdread/fdread.c Thu Apr 14 12:25:00 2016 (r297961)
+++ head/usr.sbin/fdread/fdread.c Thu Apr 14 12:46:46 2016 (r297962)
@@ -170,7 +170,7 @@ doread(int fd, FILE *of, const char *_de
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)
Modified: head/usr.sbin/fdread/fdutil.c
==============================================================================
--- head/usr.sbin/fdread/fdutil.c Thu Apr 14 12:25:00 2016 (r297961)
+++ head/usr.sbin/fdread/fdutil.c Thu Apr 14 12:46:46 2016 (r297962)
@@ -200,10 +200,10 @@ parse_fmt(const char *s, enum fd_drivety
*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();
More information about the svn-src-head
mailing list