diff options
| author | rillig <rillig@NetBSD.org> | 2023-06-23 20:59:04 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2023-06-23 20:59:04 +0000 |
| commit | e70e946d9e368d15fc31a2ac4e9b7ddd51649fdb (patch) | |
| tree | d9fd857f63439c95b0dc54c8e65f069afd5e71a0 /usr.bin | |
| parent | 2c916d81a0a8bfc3b8d0521eb1739ff44c61eff2 (diff) | |
indent: fix scanning of no-wrap comments (since 2021.11.07.10.34.03)
The "refactoring" back then tried to be too clever.
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/indent/pr_comment.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/indent/pr_comment.c b/usr.bin/indent/pr_comment.c index 47a4d8d9969..cd864307351 100644 --- a/usr.bin/indent/pr_comment.c +++ b/usr.bin/indent/pr_comment.c @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.170 2023/06/18 07:32:33 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.171 2023/06/23 20:59:04 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: pr_comment.c,v 1.170 2023/06/18 07:32:33 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.171 2023/06/23 20:59:04 rillig Exp $"); #include <string.h> @@ -325,12 +325,13 @@ copy_comment_nowrap(void) continue; } - com_add_char(*inp_p++); - if (com.len >= 2 - && com.s[com.len - 2] == '*' - && com.s[com.len - 1] == '/' - && kind == '*') + if (kind == '*' && inp_p[0] == '*' && inp_p[1] == '/') { + com_add_char(*inp_p++); + com_add_char(*inp_p++); return; + } + + com_add_char(*inp_p++); } } |
