From owner-svn-src-all@freebsd.org Mon Apr 18 05:46:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E854B12B64; Mon, 18 Apr 2016 05:46:19 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FDA111ED; Mon, 18 Apr 2016 05:46:19 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3I5kILM027825; Mon, 18 Apr 2016 05:46:18 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3I5kImI027822; Mon, 18 Apr 2016 05:46:18 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201604180546.u3I5kImI027822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Mon, 18 Apr 2016 05:46:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298182 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2016 05:46:19 -0000 Author: araujo Date: Mon Apr 18 05:46:18 2016 New Revision: 298182 URL: https://svnweb.freebsd.org/changeset/base/298182 Log: Use NULL instead of 0 for pointers. Also malloc will return NULL if it cannot allocate memory. MFC after: 2 weeks. Modified: head/usr.bin/netstat/inet.c head/usr.bin/netstat/sctp.c head/usr.bin/netstat/unix.c Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Mon Apr 18 05:26:32 2016 (r298181) +++ head/usr.bin/netstat/inet.c Mon Apr 18 05:46:18 2016 (r298182) @@ -120,7 +120,7 @@ pcblist_sysctl(int proto, const char *na 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 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; Modified: head/usr.bin/netstat/sctp.c ============================================================================== --- head/usr.bin/netstat/sctp.c Mon Apr 18 05:26:32 2016 (r298181) +++ head/usr.bin/netstat/sctp.c Mon Apr 18 05:46:18 2016 (r298182) @@ -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; } Modified: head/usr.bin/netstat/unix.c ============================================================================== --- head/usr.bin/netstat/unix.c Mon Apr 18 05:26:32 2016 (r298181) +++ head/usr.bin/netstat/unix.c Mon Apr 18 05:46:18 2016 (r298182) @@ -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 gen 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); }