Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: remove redundant parentheses



details:   https://anonhg.NetBSD.org/src/rev/0e3bc6642d5f
branches:  trunk
changeset: 953571:0e3bc6642d5f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 13 11:27:01 2021 +0000

description:
indent: remove redundant parentheses

No functional change.

diffstat:

 usr.bin/indent/indent.c     |  18 ++++++++----------
 usr.bin/indent/lexi.c       |  22 +++++++++++-----------
 usr.bin/indent/pr_comment.c |   6 +++---
 3 files changed, 22 insertions(+), 24 deletions(-)

diffs (150 lines):

diff -r 14c7610b67b9 -r 0e3bc6642d5f usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sat Mar 13 11:19:43 2021 +0000
+++ b/usr.bin/indent/indent.c   Sat Mar 13 11:27:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.51 2021/03/13 11:19:43 rillig Exp $       */
+/*     $NetBSD: indent.c,v 1.52 2021/03/13 11:27:01 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.51 2021/03/13 11:19:43 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.52 2021/03/13 11:27:01 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -604,12 +604,12 @@
            exit(found_err);
        }
        if (
-               (type_code != comment) &&
-               (type_code != newline) &&
-               (type_code != preprocessing) &&
-               (type_code != form_feed)) {
+               type_code != comment &&
+               type_code != newline &&
+               type_code != preprocessing &&
+               type_code != form_feed) {
            if (force_nl &&
-                   (type_code != semicolon) &&
+                   type_code != semicolon &&
                    (type_code != lbrace || !opt.btype_2)) {
                /* we should force a broken line here */
                if (opt.verbose)
@@ -1159,9 +1159,7 @@
            break;
 
        case preprocessing:     /* '#' */
-           if ((s_com != e_com) ||
-                   (s_lab != e_lab) ||
-                   (s_code != e_code))
+           if (s_com != e_com || s_lab != e_lab || s_code != e_code)
                dump_line();
            check_size_label(1);
            *e_lab++ = '#';     /* move whole line to 'label' buffer */
diff -r 14c7610b67b9 -r 0e3bc6642d5f usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Sat Mar 13 11:19:43 2021 +0000
+++ b/usr.bin/indent/lexi.c     Sat Mar 13 11:27:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.39 2021/03/13 09:21:57 rillig Exp $ */
+/*     $NetBSD: lexi.c,v 1.40 2021/03/13 11:27:01 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.39 2021/03/13 09:21:57 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.40 2021/03/13 11:27:01 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -502,14 +502,14 @@
        code = ident;
        break;
 
-    case ('('):
-    case ('['):
+    case '(':
+    case '[':
        unary_delim = true;
        code = lparen;
        break;
 
-    case (')'):
-    case (']'):
+    case ')':
+    case ']':
        code = rparen;
        break;
 
@@ -523,17 +523,17 @@
        code = question;
        break;
 
-    case (':'):
+    case ':':
        code = colon;
        unary_delim = true;
        break;
 
-    case (';'):
+    case ';':
        unary_delim = true;
        code = semicolon;
        break;
 
-    case ('{'):
+    case '{':
        unary_delim = true;
 
        /*
@@ -543,7 +543,7 @@
        code = lbrace;
        break;
 
-    case ('}'):
+    case '}':
        unary_delim = true;
        /* ?    code = state->block_init ? rparen : rbrace; */
        code = rbrace;
@@ -556,7 +556,7 @@
        code = form_feed;
        break;
 
-    case (','):
+    case ',':
        unary_delim = true;
        code = comma;
        break;
diff -r 14c7610b67b9 -r 0e3bc6642d5f usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sat Mar 13 11:19:43 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sat Mar 13 11:27:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.26 2021/03/13 11:19:43 rillig Exp $   */
+/*     $NetBSD: pr_comment.c,v 1.27 2021/03/13 11:27:01 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.26 2021/03/13 11:19:43 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.27 2021/03/13 11:27:01 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -147,7 +147,7 @@
                                 * is nonzero (the default). */
            break_delim = false;
        }
-       if ( /* ps.bl_line && */ (s_lab == e_lab) && (s_code == e_code)) {
+       if ( /* ps.bl_line && */ s_lab == e_lab && s_code == e_code) {
            /* klg: check only if this line is blank */
            /*
             * If this (*and previous lines are*) blank, dont put comment way



Home | Main Index | Thread Index | Old Index