Module Name:    src
Committed By:   rillig
Date:           Thu Jul  8 02:59:22 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: lex.c lint1.h

Log Message:
lint: constify keyword in lexer

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.112 -r1.113 src/usr.bin/xlint/lint1/lint1.h

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/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.51 src/usr.bin/xlint/lint1/lex.c:1.52
--- src/usr.bin/xlint/lint1/lex.c:1.51	Tue Jul  6 20:17:15 2021
+++ src/usr.bin/xlint/lint1/lex.c	Thu Jul  8 02:59:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.51 2021/07/06 20:17:15 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.52 2021/07/08 02:59:22 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.51 2021/07/06 20:17:15 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.52 2021/07/08 02:59:22 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -258,7 +258,7 @@ symt_t	symtyp;
 
 
 static void
-add_keyword(struct kwtab *kw, u_int deco)
+add_keyword(const struct kwtab *kw, u_int deco)
 {
 	sym_t *sym;
 	size_t h;
@@ -452,7 +452,7 @@ search(sbuf_t *sb)
 	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) {
-				struct kwtab *kw = sym->s_keyword;
+				const struct kwtab *kw = sym->s_keyword;
 				if (!kw->kw_attr || attron)
 					return sym;
 			} else if (!attron && sym->s_kind == symtyp)

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.112 src/usr.bin/xlint/lint1/lint1.h:1.113
--- src/usr.bin/xlint/lint1/lint1.h:1.112	Tue Jul  6 04:44:20 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Thu Jul  8 02:59:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.112 2021/07/06 04:44:20 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.113 2021/07/08 02:59:22 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -244,7 +244,7 @@ typedef	struct sym {
 	pos_t	s_set_pos;	/* position of first initialization */
 	pos_t	s_use_pos;	/* position of first use */
 	symt_t	s_kind;		/* type of symbol */
-	void   *s_keyword;
+	const struct kwtab *s_keyword;
 	bool	s_bitfield : 1;
 	bool	s_set : 1;	/* variable set, label defined */
 	bool	s_used : 1;	/* variable/label used */

Reply via email to