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: remove the '+ 1' from right margin ca...



details:   https://anonhg.NetBSD.org/src/rev/b2389a846fa9
branches:  trunk
changeset: 1019533:b2389a846fa9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 13 18:11:31 2021 +0000

description:
indent: remove the '+ 1' from right margin calculation in comment

No functional change.

diffstat:

 usr.bin/indent/pr_comment.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 124c58e329a0 -r b2389a846fa9 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sat Mar 13 17:14:11 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sat Mar 13 18:11:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.29 2021/03/13 13:51:08 rillig Exp $   */
+/*     $NetBSD: pr_comment.c,v 1.30 2021/03/13 18:11:31 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.29 2021/03/13 13:51:08 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.30 2021/03/13 18:11:31 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -200,8 +200,9 @@
            if (t_ptr >= buf_end)
                fill_buffer();
            if (t_ptr[0] == '*' && t_ptr[1] == '/') {
-               /* XXX: strange mixture between indentation, column, length */
-               if (adj_max_line_length >= 1 + indentation_after_range(ps.com_col - 1, buf_ptr, t_ptr + 2))
+               int right_margin = indentation_after_range(ps.com_col - 1,
+                   buf_ptr, t_ptr + 2);
+               if (right_margin < adj_max_line_length)
                    break_delim = false;
                break;
            }



Home | Main Index | Thread Index | Old Index