Module Name:    src
Committed By:   rillig
Date:           Thu Oct 14 20:23:43 UTC 2021

Modified Files:
        src/usr.bin/indent: pr_comment.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/indent/pr_comment.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/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.78 src/usr.bin/indent/pr_comment.c:1.79
--- src/usr.bin/indent/pr_comment.c:1.78	Thu Oct 14 20:15:18 2021
+++ src/usr.bin/indent/pr_comment.c	Thu Oct 14 20:23:43 2021
@@ -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 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #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 @@ process_comment(void)
 		? 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;
 	}
     }
 

Reply via email to