From owner-svn-src-head@freebsd.org Wed Apr 20 01:26:05 2016 Return-Path: Delivered-To: svn-src-head@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 135A4B14D5A; Wed, 20 Apr 2016 01:26:05 +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 C9A951A64; Wed, 20 Apr 2016 01:26:04 +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 u3K1Q4B2028079; Wed, 20 Apr 2016 01:26:04 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3K1Q3Cr028075; Wed, 20 Apr 2016 01:26:03 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201604200126.u3K1Q3Cr028075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 20 Apr 2016 01:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298324 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 01:26:05 -0000 Author: araujo Date: Wed Apr 20 01:26:03 2016 New Revision: 298324 URL: https://svnweb.freebsd.org/changeset/base/298324 Log: Use NULL instead of 0 for pointers. gethostbyname(3) will return NULL for error status. MFC after: 2 weeks. Modified: head/usr.bin/systat/cmds.c head/usr.bin/systat/netcmds.c head/usr.bin/systat/netstat.c Modified: head/usr.bin/systat/cmds.c ============================================================================== --- head/usr.bin/systat/cmds.c Wed Apr 20 01:21:39 2016 (r298323) +++ head/usr.bin/systat/cmds.c Wed Apr 20 01:26:03 2016 (r298324) @@ -120,10 +120,10 @@ command(const char *cmd) (*curcmd->c_close)(wnd); curcmd->c_flags &= ~CF_INIT; wnd = (*p->c_open)(); - if (wnd == 0) { + if (wnd == NULL) { error("Couldn't open new display"); wnd = (*curcmd->c_open)(); - if (wnd == 0) { + if (wnd == NULL) { error("Couldn't change back to previous cmd"); exit(1); } @@ -141,7 +141,7 @@ command(const char *cmd) status(); goto done; } - if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(tmpstr1, cp)) + if (curcmd->c_cmd == NULL || !(*curcmd->c_cmd)(tmpstr1, cp)) error("%s: Unknown command.", tmpstr1); done: free(tmpstr); Modified: head/usr.bin/systat/netcmds.c ============================================================================== --- head/usr.bin/systat/netcmds.c Wed Apr 20 01:21:39 2016 (r298323) +++ head/usr.bin/systat/netcmds.c Wed Apr 20 01:26:03 2016 (r298324) @@ -150,7 +150,7 @@ changeitems(const char *args, int onoff) continue; } hp = gethostbyname(tmpstr1); - if (hp == 0) { + if (hp == NULL) { in.s_addr = inet_addr(tmpstr1); if (in.s_addr == INADDR_NONE) { error("%s: unknown host or port", tmpstr1); @@ -167,7 +167,7 @@ static int selectproto(const char *proto) { - if (proto == 0 || streq(proto, "all")) + if (proto == NULL || streq(proto, "all")) protos = TCP | UDP; else if (streq(proto, "tcp")) protos = TCP; @@ -202,13 +202,13 @@ selectport(long port, int onoff) struct pitem *p; if (port == -1) { - if (ports == 0) + if (ports == NULL) return (0); free((char *)ports), ports = 0; nports = 0; return (1); } - for (p = ports; p < ports+nports; p++) + for (p = ports; p < ports + nports; p++) if (p->port == port) { p->onoff = onoff; return (0); @@ -258,8 +258,8 @@ selecthost(struct in_addr *in, int onoff { struct hitem *p; - if (in == 0) { - if (hosts == 0) + if (in == NULL) { + if (hosts == NULL) return (0); free((char *)hosts), hosts = 0; nhosts = 0; Modified: head/usr.bin/systat/netstat.c ============================================================================== --- head/usr.bin/systat/netstat.c Wed Apr 20 01:21:39 2016 (r298323) +++ head/usr.bin/systat/netstat.c Wed Apr 20 01:26:03 2016 (r298324) @@ -605,7 +605,7 @@ inetname(struct sockaddr *sa) if (np) cp = np->n_name; } - if (cp == 0) { + if (cp == NULL) { hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET); if (hp) cp = hp->h_name;