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: do not expand comment buffer unnecess...



details:   https://anonhg.NetBSD.org/src/rev/e3fd070d721d
branches:  trunk
changeset: 1024841:e3fd070d721d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 07 12:29:58 2021 +0000

description:
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.

diffstat:

 usr.bin/indent/pr_comment.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 8046dcad7bbe -r e3fd070d721d usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sun Nov 07 12:26:22 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sun Nov 07 12:29:58 2021 +0000
@@ -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 @@
 
 #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 @@
                    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(' ');
                }
 



Home | Main Index | Thread Index | Old Index