Module Name:    src
Committed By:   rillig
Date:           Sun Nov  7 12:29:58 UTC 2021

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

Log Message:
indent: do not expand comment buffer unnecessarily

This may have been a simple typo or a really tricky optimization that
isn't obvious even after studying the code for several months. Either of
these is bad, so use the standard form of resetting the buffer.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 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.112 src/usr.bin/indent/pr_comment.c:1.113
--- src/usr.bin/indent/pr_comment.c:1.112	Sun Nov  7 11:30:45 2021
+++ src/usr.bin/indent/pr_comment.c	Sun Nov  7 12:29:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.112 2021/11/07 11:30:45 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.113 2021/11/07 12:29:58 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.112 2021/11/07 11:30:45 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.113 2021/11/07 12:29:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -269,7 +269,7 @@ copy_comment_wrap(int adj_max_line_lengt
 		    if (com.e > com.s + 3)
 			dump_line();
 		    else
-			com.s = com.e;	/* XXX: why not e = s? */
+			com.e = com.s;
 		    com_add_char(' ');
 		}
 

Reply via email to