Module Name: src Committed By: rillig Date: Thu Oct 7 22:52:13 UTC 2021
Modified Files: src/usr.bin/indent: indent.c lexi.c Log Message: indent: clean up code, remove outdated wrong comments No functional change. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/usr.bin/indent/indent.c cvs rdiff -u -r1.76 -r1.77 src/usr.bin/indent/lexi.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.120 src/usr.bin/indent/indent.c:1.121 --- src/usr.bin/indent/indent.c:1.120 Thu Oct 7 21:57:21 2021 +++ src/usr.bin/indent/indent.c Thu Oct 7 22:52:13 2021 @@ -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 @@ static char sccsid[] = "@(#)indent.c 5.1 #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 @@ main_init_globals(void) 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; Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.76 src/usr.bin/indent/lexi.c:1.77 --- src/usr.bin/indent/lexi.c:1.76 Thu Oct 7 21:57:21 2021 +++ src/usr.bin/indent/lexi.c Thu Oct 7 22:52:13 2021 @@ -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 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #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 @@ lexi(struct parser_state *state) 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 @@ lexi(struct parser_state *state) 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 '<':