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: clarify that 25 is a magic number
details: https://anonhg.NetBSD.org/src/rev/994f224dbf80
branches: trunk
changeset: 1024262:994f224dbf80
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Oct 14 20:23:43 2021 +0000
description:
indent: clarify that 25 is a magic number
The extra line width for comments to the very right is just that, an
arbitrarily chosen number. It neither has to be a multiple of 8, nor of
the tabsize nor of the indentation. Since 25 is neither of these, this
makes it a perfect choice, allowing these extreme comments to have 22
characters per line with -sc (leading asterisks in comment
continuations, the default) or 25 without.
No functional change.
diffstat:
usr.bin/indent/pr_comment.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diffs (30 lines):
diff -r 969d656a4963 -r 994f224dbf80 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c Thu Oct 14 20:23:31 2021 +0000
+++ b/usr.bin/indent/pr_comment.c Thu Oct 14 20:23:43 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_comment.c,v 1.78 2021/10/14 20:15:18 rillig Exp $ */
+/* $NetBSD: pr_comment.c,v 1.79 2021/10/14 20:23:43 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.78 2021/10/14 20:15:18 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.79 2021/10/14 20:23:43 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -168,9 +168,8 @@
? opt.decl_comment_column - 1 : opt.comment_column - 1;
if (com_ind <= target_ind)
com_ind = next_tab(target_ind);
- /* XXX: the '+ 1' smells like an off-by-one error */
- if (com_ind + 1 + 24 > adj_max_line_length)
- adj_max_line_length = com_ind + 1 + 24;
+ if (com_ind + 25 > adj_max_line_length)
+ adj_max_line_length = com_ind + 25;
}
}
Home |
Main Index |
Thread Index |
Old Index