Module Name: src
Committed By: rillig
Date: Thu Oct 7 21:41:59 UTC 2021
Modified Files:
src/usr.bin/indent: args.c indent.c indent_globs.h lexi.c
Log Message:
indent: fix wrong or outdated comments
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/indent/args.c
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/indent/indent_globs.h
cvs rdiff -u -r1.73 -r1.74 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/args.c
diff -u src/usr.bin/indent/args.c:1.49 src/usr.bin/indent/args.c:1.50
--- src/usr.bin/indent/args.c:1.49 Thu Oct 7 19:42:41 2021
+++ src/usr.bin/indent/args.c Thu Oct 7 21:41:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: args.c,v 1.49 2021/10/07 19:42:41 rillig Exp $ */
+/* $NetBSD: args.c,v 1.50 2021/10/07 21:41:59 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,15 +43,12 @@ static char sccsid[] = "@(#)args.c 8.1 (
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.49 2021/10/07 19:42:41 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.50 2021/10/07 21:41:59 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
#endif
-/*
- * Argument scanning and profile reading code. Default parameters are set
- * here as well.
- */
+/* Read options from profile files and from the command line. */
#include <ctype.h>
#include <err.h>
Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.116 src/usr.bin/indent/indent.c:1.117
--- src/usr.bin/indent/indent.c:1.116 Thu Oct 7 21:38:25 2021
+++ src/usr.bin/indent/indent.c Thu Oct 7 21:41:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.116 2021/10/07 21:38:25 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.117 2021/10/07 21:41:59 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.116 2021/10/07 21:38:25 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.117 2021/10/07 21:41:59 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -204,8 +204,7 @@ search_brace_lbrace(void)
{
/*
* Put KNF-style lbraces before the buffered up tokens and jump out of
- * this loop in order to avoid copying the token again under the default
- * case of the switch below.
+ * this loop in order to avoid copying the token again.
*/
if (sc_end != NULL && opt.btype_2) {
save_com[0] = '{';
@@ -254,15 +253,14 @@ search_brace_other(token_type ttype, boo
sc_end--;
}
}
- if (*force_nl) { /* if we should insert a nl here, put it into
+ if (*force_nl) { /* if we should insert a nl here, put it into
* the buffer */
*force_nl = false;
--line_no; /* this will be re-increased when the newline
* is read from the buffer */
*sc_end++ = '\n';
*sc_end++ = ' ';
- if (opt.verbose) /* print error msg if the line was not already
- * broken */
+ if (opt.verbose) /* warn if the line was not already broken */
diag(0, "Line broken");
}
for (const char *t_ptr = token.s; *t_ptr != '\0'; ++t_ptr)
@@ -1359,7 +1357,7 @@ main_loop(void)
goto copy_token;
case funcname:
- case ident: /* got an identifier or constant */
+ case ident: /* an identifier, constant or string */
process_ident(ttype, decl_ind, tabs_to_var, &sp_sw, &force_nl,
hd_type);
copy_token:
Index: src/usr.bin/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.43 src/usr.bin/indent/indent_globs.h:1.44
--- src/usr.bin/indent/indent_globs.h:1.43 Thu Oct 7 19:35:50 2021
+++ src/usr.bin/indent/indent_globs.h Thu Oct 7 21:41:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent_globs.h,v 1.43 2021/10/07 19:35:50 rillig Exp $ */
+/* $NetBSD: indent_globs.h,v 1.44 2021/10/07 21:41:59 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -188,7 +188,7 @@ extern bool inhibit_formatting; /
extern struct parser_state {
token_type last_token;
- token_type p_stack[STACKSIZE]; /* this is the parsers stack */
+ token_type p_stack[STACKSIZE]; /* this is the parser's stack */
int il[STACKSIZE]; /* this stack stores indentation levels */
float cstk[STACKSIZE];/* used to store case stmt indentation levels */
bool box_com; /* whether we are in a "boxed" comment. In
Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.73 src/usr.bin/indent/lexi.c:1.74
--- src/usr.bin/indent/lexi.c:1.73 Thu Oct 7 18:32:09 2021
+++ src/usr.bin/indent/lexi.c Thu Oct 7 21:41:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lexi.c,v 1.73 2021/10/07 18:32:09 rillig Exp $ */
+/* $NetBSD: lexi.c,v 1.74 2021/10/07 21:41:59 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.73 2021/10/07 18:32:09 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.74 2021/10/07 21:41:59 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
#endif
@@ -275,7 +275,7 @@ lex_number(void)
if (num_lex_state[row][s - 'A'] == ' ') {
/*-
* num_lex_state[0][s - 'A'] now indicates the type:
- * f = floating, ch = integer, u = unknown
+ * f = floating, i = integer, u = unknown
*/
break;
}
@@ -484,7 +484,7 @@ lexi(struct parser_state *state)
* then following sign is unary */
state->last_u_d = true; /* will make "int a -1" work */
return lexi_end(ident); /* the ident is not in the list */
- } /* end of procesing for alpanum character */
+ } /* end of processing for alphanum character */
/* Scan a non-alphanumeric token */
@@ -550,7 +550,7 @@ lexi(struct parser_state *state)
case '\f':
unary_delim = state->last_u_d;
- state->last_nl = true; /* remember this so we can set 'state->col_1'
+ state->last_nl = true; /* remember this, so we can set 'state->col_1'
* right */
ttype = form_feed;
break;