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: don't use strspn on inp_p, as it is n...
details: https://anonhg.NetBSD.org/src/rev/65c1cd16498b
branches: trunk
changeset: 376621:65c1cd16498b
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jun 25 18:41:03 2023 +0000
description:
indent: don't use strspn on inp_p, as it is not null-terminated
No functional change.
diffstat:
usr.bin/indent/lexi.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 0f2a09f17448 -r 65c1cd16498b usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c Sun Jun 25 15:36:11 2023 +0000
+++ b/usr.bin/indent/lexi.c Sun Jun 25 18:41:03 2023 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index