Module Name:    src
Committed By:   rillig
Date:           Sun Jun 25 18:41:03 UTC 2023

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

Log Message:
indent: don't use strspn on inp_p, as it is not null-terminated

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/usr.bin/indent/lexi.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/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.232 src/usr.bin/indent/lexi.c:1.233
--- src/usr.bin/indent/lexi.c:1.232	Sat Jun 17 23:03:20 2023
+++ src/usr.bin/indent/lexi.c	Sun Jun 25 18:41:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.232 2023/06/17 23:03:20 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.233 2023/06/25 18:41:03 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.232 2023/06/17 23:03:20 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.233 2023/06/25 18:41:03 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -459,7 +459,10 @@ found_typename:
 static bool
 is_asterisk_pointer(void)
 {
-	if (inp_p[strspn(inp_p, "* \t")] == ')')
+	const char *p = inp_p;
+	while (*p == '*' || ch_isblank(*p))
+		p++;
+	if (*p == ')')
 		return true;
 	if (ps.next_unary || ps.in_func_def_params)
 		return true;

Reply via email to