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: clean up target column computation in...



details:   https://anonhg.NetBSD.org/src/rev/fff174a7887b
branches:  trunk
changeset: 953604:fff174a7887b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 04:42:17 2021 +0000

description:
indent: clean up target column computation in process_comment

No functional change.

diffstat:

 usr.bin/indent/pr_comment.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r 748d12f8a141 -r fff174a7887b usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sun Mar 14 03:35:39 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sun Mar 14 04:42:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.32 2021/03/14 01:34:13 rillig Exp $   */
+/*     $NetBSD: pr_comment.c,v 1.33 2021/03/14 04:42:17 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.32 2021/03/14 01:34:13 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.33 2021/03/14 04:42:17 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -145,15 +145,16 @@
            if (ps.com_col <= 1)
                ps.com_col = 1 + !opt.format_col1_comments;
        } else {
+           break_delim = false;
+           
            int target_col;
-           break_delim = false;
            if (s_code != e_code)
                target_col = 1 + indentation_after(compute_code_indent(), s_code);
-           else {
+           else if (s_lab != e_lab)
+               target_col = 1 + indentation_after(compute_label_indent(), s_lab);
+           else 
                target_col = 1;
-               if (s_lab != e_lab)
-                   target_col = 1 + indentation_after(compute_label_indent(), s_lab);
-           }
+           
            ps.com_col = ps.decl_on_line || ps.ind_level == 0
                ? opt.decl_comment_column : opt.comment_column;
            if (ps.com_col <= target_col)



Home | Main Index | Thread Index | Old Index