summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authoraraujo <araujo@FreeBSD.org>2016-04-18 05:46:18 +0000
committeraraujo <araujo@FreeBSD.org>2016-04-18 05:46:18 +0000
commitd2d25bb0ca583e8268be8a67a3b38491a95bdb46 (patch)
tree74174a64e8de16f60d8882a1edded749291bb319 /usr.bin
parent0bd7ac2f20a043ce7a134de7a12c36437eb2c977 (diff)
downloadFreeBSD-src-d2d25bb0ca583e8268be8a67a3b38491a95bdb46.zip
FreeBSD-src-d2d25bb0ca583e8268be8a67a3b38491a95bdb46.tar.gz
Use NULL instead of 0 for pointers.
Also malloc will return NULL if it cannot allocate memory. MFC after: 2 weeks.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/inet.c6
-rw-r--r--usr.bin/netstat/sctp.c4
-rw-r--r--usr.bin/netstat/unix.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 4793229..54ab56f 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -120,7 +120,7 @@ pcblist_sysctl(int proto, const char *name, char **bufp, int istcp __unused)
xo_warn("sysctl: %s", mibvar);
return (0);
}
- if ((buf = malloc(len)) == 0) {
+ if ((buf = malloc(len)) == NULL) {
xo_warnx("malloc %lu bytes", (u_long)len);
return (0);
}
@@ -207,7 +207,7 @@ pcblist_kvm(u_long off, char **bufp, int istcp)
len = 2 * sizeof(xig) +
(pcbinfo.ipi_count + pcbinfo.ipi_count / 8) *
sizeof(struct xinpcb);
- if ((buf = malloc(len)) == 0) {
+ if ((buf = malloc(len)) == NULL) {
xo_warnx("malloc %lu bytes", (u_long)len);
return (0);
}
@@ -1460,7 +1460,7 @@ inetname(struct in_addr *inp)
if (np)
cp = np->n_name;
}
- if (cp == 0) {
+ if (cp == NULL) {
hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
if (hp) {
cp = hp->h_name;
diff --git a/usr.bin/netstat/sctp.c b/usr.bin/netstat/sctp.c
index 6c766b2..db40f9c 100644
--- a/usr.bin/netstat/sctp.c
+++ b/usr.bin/netstat/sctp.c
@@ -128,7 +128,7 @@ inetname(struct in_addr *inp)
if (np)
cp = np->n_name;
}
- if (cp == 0) {
+ if (cp == NULL) {
hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
if (hp) {
cp = hp->h_name;
@@ -586,7 +586,7 @@ sctp_protopr(u_long off __unused,
xo_warn("sysctl: %s", mibvar);
return;
}
- if ((buf = malloc(len)) == 0) {
+ if ((buf = malloc(len)) == NULL) {
xo_warnx("malloc %lu bytes", (u_long)len);
return;
}
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c
index 04e4ae5..29668a4 100644
--- a/usr.bin/netstat/unix.c
+++ b/usr.bin/netstat/unix.c
@@ -83,7 +83,7 @@ pcblist_sysctl(int type, char **bufp)
xo_warn("sysctl: %s", mibvar);
return (-1);
}
- if ((buf = malloc(len)) == 0) {
+ if ((buf = malloc(len)) == NULL) {
xo_warnx("malloc %lu bytes", (u_long)len);
return (-2);
}
@@ -116,7 +116,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp)
return (-1);
kread(count_off, &unp_count, sizeof(unp_count));
len = 2 * sizeof(xug) + (unp_count + unp_count / 8) * sizeof(xu);
- if ((buf = malloc(len)) == 0) {
+ if ((buf = malloc(len)) == NULL) {
xo_warnx("malloc %lu bytes", (u_long)len);
return (-2);
}
OpenPOWER on IntegriCloud