Module Name:    src
Committed By:   rillig
Date:           Tue Oct 12 22:04:03 UTC 2021

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

Log Message:
indent: negate a few condition in process_comment

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 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.73 src/usr.bin/indent/pr_comment.c:1.74
--- src/usr.bin/indent/pr_comment.c:1.73	Tue Oct 12 21:08:37 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 22:04:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.73 2021/10/12 21:08:37 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.74 2021/10/12 22:04:03 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.73 2021/10/12 21:08:37 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.74 2021/10/12 22:04:03 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -315,14 +315,17 @@ process_comment(void)
 	default:		/* we have a random char */
 	    ;
 	    int now_len = indentation_after_range(ps.com_ind, com.s, com.e);
-	    do {
+	    for (;;) {
 		char ch = inbuf_next();
 		if (is_hspace(ch))
 		    last_blank = com.e - com.buf;
 		com_add_char(ch);
 		now_len++;
-	    } while (memchr("*\n\r\b\t", *inp.s, 6) == NULL &&
-		(now_len < adj_max_line_length || last_blank == -1));
+		if (memchr("*\n\r\b\t", *inp.s, 6) != NULL)
+		    break;
+		if (now_len >= adj_max_line_length && last_blank != -1)
+		    break;
+	    }
 
 	    ps.last_nl = false;
 

Reply via email to