Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: reduce indentation in 'search'



details:   https://anonhg.NetBSD.org/src/rev/ebc37557bc56
branches:  trunk
changeset: 1022647:ebc37557bc56
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 31 13:47:19 2021 +0000

description:
lint: reduce indentation in 'search'

No functional change.

diffstat:

 usr.bin/xlint/lint1/lex.c |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (48 lines):

diff -r ca90a1773556 -r ebc37557bc56 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Jul 31 11:37:53 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Jul 31 13:47:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.56 2021/07/23 15:36:56 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.57 2021/07/31 13:47:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.56 2021/07/23 15:36:56 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.57 2021/07/31 13:47:19 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -450,17 +450,20 @@
 static sym_t *
 search(sbuf_t *sb)
 {
-       sym_t   *sym;
+       sym_t *sym;
+       const struct kwtab *kw;
 
        for (sym = symtab[sb->sb_hash]; sym != NULL; sym = sym->s_link) {
-               if (strcmp(sym->s_name, sb->sb_name) == 0) {
-                       if (sym->s_keyword != NULL) {
-                               const struct kwtab *kw = sym->s_keyword;
-                               if (!kw->kw_attr || attron)
-                                       return sym;
-                       } else if (!attron && sym->s_kind == symtyp)
-                               return sym;
-               }
+               if (strcmp(sym->s_name, sb->sb_name) != 0)
+                       continue;
+               kw = sym->s_keyword;
+
+               if (kw != NULL && !kw->kw_attr)
+                       return sym;
+               if (kw != NULL && attron)
+                       return sym;
+               if (kw == NULL && !attron && sym->s_kind == symtyp)
+                       return sym;
        }
 
        return NULL;



Home | Main Index | Thread Index | Old Index