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: reduce complexity of reading a fun...
details: https://anonhg.NetBSD.org/src/rev/ff5f718ad384
branches: trunk
changeset: 985705:ff5f718ad384
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Sep 04 19:16:38 2021 +0000
description:
lint: reduce complexity of reading a function call
No functional change.
diffstat:
usr.bin/xlint/lint2/read.c | 80 +++++++++++++++++++++++----------------------
1 files changed, 41 insertions(+), 39 deletions(-)
diffs (103 lines):
diff -r 67b1deedd745 -r ff5f718ad384 usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c Sat Sep 04 18:58:57 2021 +0000
+++ b/usr.bin/xlint/lint2/read.c Sat Sep 04 19:16:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.63 2021/08/30 21:35:23 rillig Exp $ */
+/* $NetBSD: read.c,v 1.64 2021/09/04 19:16:38 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.63 2021/08/30 21:35:23 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.64 2021/09/04 19:16:38 rillig Exp $");
#endif
#include <ctype.h>
@@ -307,45 +307,47 @@
/* read flags */
rused = rdisc = false;
lai = &fcall->f_args;
- while ((c = *cp) == 'u' || c == 'i' || c == 'd' ||
- c == 'z' || c == 'p' || c == 'n' || c == 's') {
- cp++;
- switch (c) {
- case 'u':
- if (rused || rdisc)
- inperr("used or discovered: %c", c);
- rused = true;
- break;
- case 'i':
- if (rused || rdisc)
- inperr("used or discovered: %c", c);
- break;
- case 'd':
- if (rused || rdisc)
- inperr("used or discovered: %c", c);
- rdisc = true;
- break;
- case 'z':
- case 'p':
- case 'n':
- case 's':
- ai = xalloc(sizeof(*ai));
- ai->a_num = parse_int(&cp);
- if (c == 'z') {
- ai->a_pcon = ai->a_zero = true;
- } else if (c == 'p') {
- ai->a_pcon = true;
- } else if (c == 'n') {
- ai->a_ncon = true;
- } else {
- ai->a_fmt = true;
- ai->a_fstrg = inpqstrg(cp, &cp);
- }
- *lai = ai;
- lai = &ai->a_next;
- break;
+
+again:
+ c = *cp++;
+ switch (c) {
+ case 'u':
+ if (rused || rdisc)
+ inperr("used or discovered: %c", c);
+ rused = true;
+ goto again;
+ case 'i':
+ if (rused || rdisc)
+ inperr("used or discovered: %c", c);
+ goto again;
+ case 'd':
+ if (rused || rdisc)
+ inperr("used or discovered: %c", c);
+ rdisc = true;
+ goto again;
+ case 'z':
+ case 'p':
+ case 'n':
+ case 's':
+ ai = xalloc(sizeof(*ai));
+ ai->a_num = parse_int(&cp);
+ if (c == 'z') {
+ ai->a_pcon = ai->a_zero = true;
+ } else if (c == 'p') {
+ ai->a_pcon = true;
+ } else if (c == 'n') {
+ ai->a_ncon = true;
+ } else {
+ ai->a_fmt = true;
+ ai->a_fstrg = inpqstrg(cp, &cp);
}
+ *lai = ai;
+ lai = &ai->a_next;
+ goto again;
+ default:
+ cp--;
}
+
fcall->f_rused = rused;
fcall->f_rdisc = rdisc;
Home |
Main Index |
Thread Index |
Old Index