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: merge duplicate code for parsing 'str...



details:   https://anonhg.NetBSD.org/src/rev/b68a70ffd787
branches:  trunk
changeset: 1026447:b68a70ffd787
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Nov 25 08:08:28 2021 +0000

description:
indent: merge duplicate code for parsing 'struct s *'

No functional change.

diffstat:

 usr.bin/indent/lexi.c |  13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diffs (35 lines):

diff -r 9bbd6584a737 -r b68a70ffd787 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Thu Nov 25 08:03:08 2021 +0000
+++ b/usr.bin/indent/lexi.c     Thu Nov 25 08:08:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.153 2021/11/25 08:03:08 rillig Exp $        */
+/*     $NetBSD: lexi.c,v 1.154 2021/11/25 08:08:28 rillig Exp $        */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.153 2021/11/25 08:03:08 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.154 2021/11/25 08:08:28 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -471,13 +471,10 @@
     while (ch_isblank(inp_peek()))
        inp_skip();
 
-    if (ps.prev_token == lsym_tag && ps.p_l_follow == 0) {
-       ps.next_unary = true;
+    ps.next_unary = ps.prev_token == lsym_tag; /* for 'struct s *' */
+
+    if (ps.prev_token == lsym_tag && ps.p_l_follow == 0)
        return lsym_type_outside_parentheses;
-    }
-
-    /* Operator after identifier is binary unless last token was 'struct'. */
-    ps.next_unary = ps.prev_token == lsym_tag;
 
     const struct keyword *kw = bsearch(token.s, keywords,
        array_length(keywords), sizeof(keywords[0]), cmp_keyword_by_name);



Home | Main Index | Thread Index | Old Index