svn commit: r298324 - head/usr.bin/systat

Marcelo Araujo araujo at FreeBSD.org
Wed Apr 20 01:26:05 UTC 2016


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;


More information about the svn-src-all mailing list