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 process_comment



details:   https://anonhg.NetBSD.org/src/rev/0d119c2e20af
branches:  trunk
changeset: 1024836:0d119c2e20af
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 07 10:49:31 2021 +0000

description:
indent: clean up process_comment

The assignments to the variables were redundant, they are already done
by analyze_comment.

No functional change.

diffstat:

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

diffs (55 lines):

diff -r 67d4b595cc34 -r 0d119c2e20af usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sun Nov 07 10:42:58 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sun Nov 07 10:49:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.108 2021/11/07 10:42:58 rillig Exp $  */
+/*     $NetBSD: pr_comment.c,v 1.109 2021/11/07 10:49:31 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.108 2021/11/07 10:42:58 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.109 2021/11/07 10:49:31 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -100,8 +100,8 @@
 }
 
 static void
-analyze_comment(int *p_adj_max_line_length, bool *p_break_delim,
-    bool *p_may_wrap)
+analyze_comment(bool *p_may_wrap, bool *p_break_delim,
+    int *p_adj_max_line_length)
 {
     int adj_max_line_length;   /* Adjusted max_line_length for comments that
                                 * spill over the right margin */
@@ -381,20 +381,17 @@
 void
 process_comment(void)
 {
-    int adj_max_line_length;   /* Adjusted max_line_length for comments that
-                                * spill over the right margin */
-    bool break_delim = opt.comment_delimiter_on_blankline;
+    int adj_max_line_length;
+    bool may_wrap, break_delim;
 
-    adj_max_line_length = opt.max_line_length;
     ps.just_saw_decl = 0;
-    bool may_wrap = true;
     ps.stats.comments++;
 
-    int l_just_saw_decl = ps.just_saw_decl;
-    analyze_comment(&adj_max_line_length, &break_delim, &may_wrap);
+    int saved_just_saw_decl = ps.just_saw_decl;
+    analyze_comment(&may_wrap, &break_delim, &adj_max_line_length);
     if (may_wrap)
        copy_comment_wrap(adj_max_line_length, break_delim);
     else
        copy_comment_nowrap();
-    ps.just_saw_decl = l_just_saw_decl;
+    ps.just_saw_decl = saved_just_saw_decl;
 }



Home | Main Index | Thread Index | Old Index