Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 19:36:10 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303502 - head/usr.bin/indent
Message-ID:  <201607291936.u6TJaALj035130@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri Jul 29 19:36:10 2016
New Revision: 303502
URL: https://svnweb.freebsd.org/changeset/base/303502

Log:
  indent(1): Use NULL instead of zero for pointers.

Modified:
  head/usr.bin/indent/args.c
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/io.c
  head/usr.bin/indent/lexi.c
  head/usr.bin/indent/pr_comment.c

Modified: head/usr.bin/indent/args.c
==============================================================================
--- head/usr.bin/indent/args.c	Fri Jul 29 18:26:15 2016	(r303501)
+++ head/usr.bin/indent/args.c	Fri Jul 29 19:36:10 2016	(r303502)
@@ -280,9 +280,9 @@ found:
 	    break;
 
 	case STDIN:
-	    if (input == 0)
+	    if (input == NULL)
 		input = stdin;
-	    if (output == 0)
+	    if (output == NULL)
 		output = stdout;
 	    break;
 

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c	Fri Jul 29 18:26:15 2016	(r303501)
+++ head/usr.bin/indent/indent.c	Fri Jul 29 19:36:10 2016	(r303502)
@@ -147,11 +147,11 @@ main(int argc, char **argv)
 
     scase = ps.pcase = false;
     squest = 0;
-    sc_end = 0;
-    bp_save = 0;
-    be_save = 0;
+    sc_end = NULL;
+    bp_save = NULL;
+    be_save = NULL;
 
-    output = 0;
+    output = NULL;
     tabs_to_var = 0;
 
     /*--------------------------------------------------*\
@@ -328,7 +328,7 @@ main(int argc, char **argv)
 
 	    case lbrace:	/* this is a brace that starts the compound
 				 * stmt */
-		if (sc_end == 0) {	/* ignore buffering if a comment wasn't
+		if (sc_end == NULL) {	/* ignore buffering if a comment wasn't
 					 * stored up */
 		    ps.search_brace = false;
 		    goto check_type;
@@ -341,8 +341,8 @@ main(int argc, char **argv)
 		}
 	    case comment:	/* we have a comment, so we must copy it into
 				 * the buffer */
-		if (!flushed_nl || sc_end != 0) {
-		    if (sc_end == 0) {	/* if this is the first comment, we
+		if (!flushed_nl || sc_end != NULL) {
+		    if (sc_end == NULL) {	/* if this is the first comment, we
 					 * must set up the buffer */
 			save_com[0] = save_com[1] = ' ';
 			sc_end = &(save_com[2]);
@@ -386,7 +386,7 @@ main(int argc, char **argv)
 			&& e_code != s_code && e_code[-1] == '}'))
 		    force_nl = false;
 
-		if (sc_end == 0) {	/* ignore buffering if comment wasn't
+		if (sc_end == NULL) {	/* ignore buffering if comment wasn't
 					 * saved up */
 		    ps.search_brace = false;
 		    goto check_type;
@@ -417,7 +417,7 @@ main(int argc, char **argv)
 					 * save_com */
 		*sc_end++ = ' ';/* add trailing blank, just in case */
 		buf_end = sc_end;
-		sc_end = 0;
+		sc_end = NULL;
 		break;
 	    }			/* end of switch */
 	    if (type_code != 0)	/* we must make this check, just in case there
@@ -1101,9 +1101,9 @@ check_type:
 
 		while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t'))
 		    e_lab--;
-		if (e_lab - s_lab == com_end && bp_save == 0) {	/* comment on
-								 * preprocessor line */
-		    if (sc_end == 0)	/* if this is the first comment, we
+		/* comment on preprocessor line */
+		if (e_lab - s_lab == com_end && bp_save == NULL) {
+		    if (sc_end == NULL)	/* if this is the first comment, we
 					 * must set up the buffer */
 			sc_end = &(save_com[0]);
 		    else {
@@ -1126,7 +1126,7 @@ check_type:
 					 * save_com */
 		    *sc_end++ = ' ';	/* add trailing blank, just in case */
 		    buf_end = sc_end;
-		    sc_end = 0;
+		    sc_end = NULL;
 		}
 		*e_lab = '\0';	/* null terminate line */
 		ps.pcase = false;

Modified: head/usr.bin/indent/io.c
==============================================================================
--- head/usr.bin/indent/io.c	Fri Jul 29 18:26:15 2016	(r303501)
+++ head/usr.bin/indent/io.c	Fri Jul 29 19:36:10 2016	(r303502)
@@ -348,10 +348,10 @@ fill_buffer(void)
     int i;
     FILE *f = input;
 
-    if (bp_save != 0) {		/* there is a partly filled input buffer left */
+    if (bp_save != NULL) {		/* there is a partly filled input buffer left */
 	buf_ptr = bp_save;	/* dont read anything, just switch buffers */
 	buf_end = be_save;
-	bp_save = be_save = 0;
+	bp_save = be_save = NULL;
 	if (buf_ptr < buf_end)
 	    return;		/* only return if there is really something in
 				 * this buffer */

Modified: head/usr.bin/indent/lexi.c
==============================================================================
--- head/usr.bin/indent/lexi.c	Fri Jul 29 18:26:15 2016	(r303501)
+++ head/usr.bin/indent/lexi.c	Fri Jul 29 19:36:10 2016	(r303502)
@@ -262,7 +262,7 @@ lexi(void)
 	/*
 	 * This loop will check if the token is a keyword.
 	 */
-	for (p = specials; (j = p->rwd) != 0; p++) {
+	for (p = specials; (j = p->rwd) != NULL; p++) {
 	    const char *q = s_token;	/* point at scanned token */
 	    if (*j++ != *q++ || *j++ != *q++)
 		continue;	/* This test depends on the fact that
@@ -601,6 +601,6 @@ addkey(char *key, int val)
 				 * ignored */
     p->rwd = key;
     p->rwcode = val;
-    p[1].rwd = 0;
+    p[1].rwd = NULL;
     p[1].rwcode = 0;
 }

Modified: head/usr.bin/indent/pr_comment.c
==============================================================================
--- head/usr.bin/indent/pr_comment.c	Fri Jul 29 18:26:15 2016	(r303501)
+++ head/usr.bin/indent/pr_comment.c	Fri Jul 29 19:36:10 2016	(r303502)
@@ -100,7 +100,7 @@ pr_comment(void)
     int         one_liner = 1;	/* true iff this comment is a one-liner */
     adj_max_col = max_col;
     ps.just_saw_decl = 0;
-    last_bl = 0;		/* no blanks found so far */
+    last_bl = NULL;		/* no blanks found so far */
     ps.box_com = false;		/* at first, assume that we are not in
 					 * a boxed comment or some other
 					 * comment that should not be touched */
@@ -196,7 +196,7 @@ pr_comment(void)
 		ps.use_ff = true;
 		/* fix so dump_line uses a form feed */
 		dump_line();
-		last_bl = 0;
+		last_bl = NULL;
 		*e_com++ = ' ';
 		*e_com++ = '*';
 		*e_com++ = ' ';
@@ -392,7 +392,7 @@ pr_comment(void)
 		    e_com = t;
 		    s_com[0] = s_com[1] = s_com[2] = ' ';
 		}
-		if (last_bl == 0) {	/* we have seen no blanks */
+		if (last_bl == NULL) {	/* we have seen no blanks */
 		    last_bl = e_com;	/* fake it */
 		    *e_com++ = ' ';
 		}
@@ -408,7 +408,7 @@ pr_comment(void)
 		*e_com++ = ' ';
 
 		t_ptr = last_bl + 1;
-		last_bl = 0;
+		last_bl = NULL;
 		if (t_ptr >= e_com) {
 		    while (*t_ptr == ' ' || *t_ptr == '\t')
 			t_ptr++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607291936.u6TJaALj035130>