Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint2 lint: simplify reading of type qualifier...
details: https://anonhg.NetBSD.org/src/rev/1f32c8a76de4
branches: trunk
changeset: 1023068:1f32c8a76de4
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Aug 22 12:32:13 2021 +0000
description:
lint: simplify reading of type qualifiers in lint2
The only producer of .ln files is lint1, which always writes the type
qualifiers in the order 'c', 'v', therefore there is no need to expect
any other order or check for duplicates. There is no ambiguity since
the other type modifiers are neither 'c' nor 'v' and the main types are
all uppercase letters.
No functional change.
diffstat:
usr.bin/xlint/lint2/read.c | 33 +++++++++++----------------------
1 files changed, 11 insertions(+), 22 deletions(-)
diffs (67 lines):
diff -r b3298a91d80b -r 1f32c8a76de4 usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c Sun Aug 22 12:25:16 2021 +0000
+++ b/usr.bin/xlint/lint2/read.c Sun Aug 22 12:32:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.52 2021/08/22 12:25:16 rillig Exp $ */
+/* $NetBSD: read.c,v 1.53 2021/08/22 12:32:13 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: read.c,v 1.52 2021/08/22 12:25:16 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.53 2021/08/22 12:32:13 rillig Exp $");
#endif
#include <ctype.h>
@@ -643,12 +643,12 @@
c = *cp++;
- while (c == 'c' || c == 'v') {
- if (c == 'c') {
- tp->t_const = true;
- } else {
- tp->t_volatile = true;
- }
+ if (c == 'c') {
+ tp->t_const = true;
+ c = *cp++;
+ }
+ if (c == 'v') {
+ tp->t_volatile = true;
c = *cp++;
}
@@ -726,26 +726,15 @@
char c, s;
tspec_t t;
int narg, i;
- bool cm, vm;
cp1 = cp;
c = *cp++;
- cm = vm = false;
-
- while (c == 'c' || c == 'v') {
- if (c == 'c') {
- if (cm)
- inperr("cm: %c", c);
- cm = true;
- } else {
- if (vm)
- inperr("vm: %c", c);
- vm = true;
- }
+ if (c == 'c')
c = *cp++;
- }
+ if (c == 'v')
+ c = *cp++;
switch (c) {
case 's':
Home |
Main Index |
Thread Index |
Old Index