svn commit: r304651 - head/usr.bin/indent

Pedro F. Giffuni pfg at FreeBSD.org
Tue Aug 23 01:58:04 UTC 2016


Author: pfg
Date: Tue Aug 23 01:58:02 2016
New Revision: 304651
URL: https://svnweb.freebsd.org/changeset/base/304651

Log:
  indent(1): add some comments to quiet down Coverity.
  
  Hopefully adding comments should help explain the code to both static
  checkers and humans.
  
  CID:	976543, 976544, 976545
  Obtained from:	Piotr Stephaniak

Modified:
  head/usr.bin/indent/io.c
  head/usr.bin/indent/parse.c

Modified: head/usr.bin/indent/io.c
==============================================================================
--- head/usr.bin/indent/io.c	Tue Aug 23 01:40:45 2016	(r304650)
+++ head/usr.bin/indent/io.c	Tue Aug 23 01:58:02 2016	(r304651)
@@ -200,6 +200,7 @@ dump_line(void)
 				break;
 			    case '\\':
 				putc('\\', output);
+				/* add a backslash to escape the '\' */
 			    default:
 				putc(*follow, output);
 			    }

Modified: head/usr.bin/indent/parse.c
==============================================================================
--- head/usr.bin/indent/parse.c	Tue Aug 23 01:40:45 2016	(r304650)
+++ head/usr.bin/indent/parse.c	Tue Aug 23 01:58:02 2016	(r304651)
@@ -95,6 +95,7 @@ parse(int tk) /* tk: the code for the co
     case ifstmt:		/* scanned if (...) */
 	if (ps.p_stack[ps.tos] == elsehead && ps.else_if)	/* "else if ..." */
 	    ps.i_l_follow = ps.il[ps.tos];
+	/* the rest is the same as for dolit and forstmt */
     case dolit:		/* 'do' */
     case forstmt:		/* for (...) */
 	ps.p_stack[++ps.tos] = tk;
@@ -301,7 +302,7 @@ reduce(void)
 	    case swstmt:
 		/* <switch> <stmt> */
 		case_ind = ps.cstk[ps.tos - 1];
-
+		/* FALLTHROUGH */
 	    case decl:		/* finish of a declaration */
 	    case elsehead:
 		/* <<if> <stmt> else> <stmt> */


More information about the svn-src-head mailing list