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: clean up code, remove outdated wrong ...



details:   https://anonhg.NetBSD.org/src/rev/17c19d16337c
branches:  trunk
changeset: 988623:17c19d16337c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 07 22:52:13 2021 +0000

description:
indent: clean up code, remove outdated wrong comments

No functional change.

diffstat:

 usr.bin/indent/indent.c |   6 +++---
 usr.bin/indent/lexi.c   |  11 ++++-------
 2 files changed, 7 insertions(+), 10 deletions(-)

diffs (71 lines):

diff -r efcf293b2e6e -r 17c19d16337c usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Thu Oct 07 21:57:21 2021 +0000
+++ b/usr.bin/indent/indent.c   Thu Oct 07 22:52:13 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.120 2021/10/07 21:57:21 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.121 2021/10/07 22:52:13 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.120 2021/10/07 21:57:21 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.121 2021/10/07 22:52:13 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -446,7 +446,7 @@
     in_buffer_limit = in_buffer + 8;
     buf_ptr = buf_end = in_buffer;
     line_no = 1;
-    had_eof = ps.in_decl = ps.decl_on_line = (break_comma = false);
+    had_eof = ps.in_decl = ps.decl_on_line = break_comma = false;
 
     ps.in_or_st = false;
     ps.want_blank = ps.in_stmt = ps.ind_stmt = false;
diff -r efcf293b2e6e -r 17c19d16337c usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Thu Oct 07 21:57:21 2021 +0000
+++ b/usr.bin/indent/lexi.c     Thu Oct 07 22:52:13 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.76 2021/10/07 21:57:21 rillig Exp $ */
+/*     $NetBSD: lexi.c,v 1.77 2021/10/07 22:52:13 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.76 2021/10/07 21:57:21 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.77 2021/10/07 22:52:13 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -478,8 +478,7 @@
        if (*buf_ptr == '(' && state->tos <= 1 && state->ind_level == 0 &&
            !state->in_parameter_declaration && !state->block_init) {
 
-           char *tp = buf_ptr;
-           while (tp < buf_end)
+           for (char *tp = buf_ptr; tp < buf_end;)
                if (*tp++ == ')' && (*tp == ';' || *tp == ','))
                    goto not_proc;
 
@@ -614,14 +613,12 @@
        if (state->in_or_st)
            state->block_init = true;
        if (*buf_ptr == '=') {  /* == */
-           *token.e++ = '=';   /* Flip =+ to += */
-           buf_ptr++;
+           *token.e++ = *buf_ptr++;
            *token.e = '\0';
        }
        ttype = binary_op;
        unary_delim = true;
        break;
-       /* can drop thru!!! */
 
     case '>':
     case '<':



Home | Main Index | Thread Index | Old Index