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: replace unreachable code with assertion



details:   https://anonhg.NetBSD.org/src/rev/0ec8a05cce08
branches:  trunk
changeset: 1024221:0ec8a05cce08
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Oct 12 19:57:53 2021 +0000

description:
indent: replace unreachable code with assertion

diffstat:

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

diffs (28 lines):

diff -r 4831983f6c23 -r 0ec8a05cce08 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Tue Oct 12 19:56:07 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Tue Oct 12 19:57:53 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.71 2021/10/12 19:56:07 rillig Exp $   */
+/*     $NetBSD: pr_comment.c,v 1.72 2021/10/12 19:57:53 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.71 2021/10/12 19:56:07 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.72 2021/10/12 19:57:53 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -356,8 +356,7 @@
                 * enough.
                 */
                while (*p != '\0') {
-                   if (is_hspace(*p))
-                       last_blank = com.e - com.buf;
+                   assert(!is_hspace(*p));
                    *com.e++ = *p++;
                }
            }



Home | Main Index | Thread Index | Old Index