Module Name: src Committed By: rillig Date: Thu Oct 7 21:57:21 UTC 2021
Modified Files: src/usr.bin/indent: indent.c io.c lexi.c pr_comment.c Log Message: indent: use braces around multi-line statements No functional change. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/usr.bin/indent/indent.c cvs rdiff -u -r1.77 -r1.78 src/usr.bin/indent/io.c cvs rdiff -u -r1.75 -r1.76 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.56 -r1.57 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.119 src/usr.bin/indent/indent.c:1.120 --- src/usr.bin/indent/indent.c:1.119 Thu Oct 7 21:52:54 2021 +++ src/usr.bin/indent/indent.c Thu Oct 7 21:57:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.119 2021/10/07 21:52:54 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.120 2021/10/07 21:57:21 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.119 2021/10/07 21:52:54 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.120 2021/10/07 21:57:21 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -248,9 +248,8 @@ search_brace_other(token_type ttype, boo return false; } - while (sc_end > save_com && isblank((unsigned char)sc_end[-1])) { + while (sc_end > save_com && isblank((unsigned char)sc_end[-1])) sc_end--; - } if (opt.swallow_optional_blanklines || (!comment_buffered && remove_newlines)) { @@ -1430,9 +1429,7 @@ main_loop(void) } *code.e = '\0'; - if (ttype != comment && - ttype != newline && - ttype != preprocessing) + if (ttype != comment && ttype != newline && ttype != preprocessing) ps.last_token = ttype; } } Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.77 src/usr.bin/indent/io.c:1.78 --- src/usr.bin/indent/io.c:1.77 Thu Oct 7 21:52:54 2021 +++ src/usr.bin/indent/io.c Thu Oct 7 21:57:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.77 2021/10/07 21:52:54 rillig Exp $ */ +/* $NetBSD: io.c,v 1.78 2021/10/07 21:57:21 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.77 2021/10/07 21:52:54 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.78 2021/10/07 21:57:21 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -296,13 +296,13 @@ compute_code_indent(void) int target_ind = opt.indent_size * ps.ind_level; if (ps.paren_level != 0) { - if (!opt.lineup_to_parens) + if (!opt.lineup_to_parens) { if (2 * opt.continuation_indent == opt.indent_size) target_ind += opt.continuation_indent; else target_ind += opt.continuation_indent * ps.paren_level; - else if (opt.lineup_to_parens_always) + } else if (opt.lineup_to_parens_always) { /* * XXX: where does this '- 1' come from? It looks strange but is * nevertheless needed for proper indentation, as demonstrated in @@ -310,7 +310,7 @@ compute_code_indent(void) */ target_ind = paren_indent - 1; - else { + } else { int w; int t = paren_indent; Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.75 src/usr.bin/indent/lexi.c:1.76 --- src/usr.bin/indent/lexi.c:1.75 Thu Oct 7 21:52:54 2021 +++ src/usr.bin/indent/lexi.c Thu Oct 7 21:57:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.75 2021/10/07 21:52:54 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.76 2021/10/07 21:57:21 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.75 2021/10/07 21:52:54 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.76 2021/10/07 21:57:21 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -596,11 +596,11 @@ lexi(struct parser_state *state) unary_delim = false; } - } else if (*buf_ptr == '=') + } else if (*buf_ptr == '=') { /* check for operator += */ *token.e++ = *buf_ptr++; - else if (*buf_ptr == '>') { + } else if (*buf_ptr == '>') { /* check for operator -> */ *token.e++ = *buf_ptr++; unary_delim = false; Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.56 src/usr.bin/indent/pr_comment.c:1.57 --- src/usr.bin/indent/pr_comment.c:1.56 Thu Oct 7 21:52:54 2021 +++ src/usr.bin/indent/pr_comment.c Thu Oct 7 21:57:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.56 2021/10/07 21:52:54 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.57 2021/10/07 21:57:21 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.56 2021/10/07 21:52:54 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.57 2021/10/07 21:57:21 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -175,7 +175,7 @@ process_comment(void) *com.e++ = ' '; /* Don't put a break delimiter if this is a one-liner that won't wrap. */ - if (break_delim) + if (break_delim) { for (t_ptr = buf_ptr; *t_ptr != '\0' && *t_ptr != '\n'; t_ptr++) { if (t_ptr >= buf_end) fill_buffer(); @@ -192,6 +192,7 @@ process_comment(void) break; } } + } if (break_delim) { char *t = com.e;