Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ddb Simplify logic to get rid of implicit dependence on ...
details: https://anonhg.NetBSD.org/src/rev/ba854d24deb8
branches: trunk
changeset: 464314:ba854d24deb8
user: rin <rin%NetBSD.org@localhost>
date: Wed Oct 02 09:36:30 2019 +0000
description:
Simplify logic to get rid of implicit dependence on order of ASCII
codes of upper and lower cases ('a' > 'A').
Found by the lgtm bot.
No functional changes intended.
diffstat:
sys/ddb/db_lex.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diffs (40 lines):
diff -r 31ab849d7d2e -r ba854d24deb8 sys/ddb/db_lex.c
--- a/sys/ddb/db_lex.c Wed Oct 02 08:21:08 2019 +0000
+++ b/sys/ddb/db_lex.c Wed Oct 02 09:36:30 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_lex.c,v 1.23 2019/09/29 02:00:22 uwe Exp $ */
+/* $NetBSD: db_lex.c,v 1.24 2019/10/02 09:36:30 rin Exp $ */
/*
* Mach Operating System
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.23 2019/09/29 02:00:22 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.24 2019/10/02 09:36:30 rin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -210,14 +210,14 @@
for (;;) {
if (c >= '0' && c <= ((r == 8) ? '7' : '9'))
digit = c - '0';
- else if (r == 16 && ((c >= 'A' && c <= 'F') ||
- (c >= 'a' && c <= 'f'))) {
- if (c >= 'a')
+ else if (r == 16) {
+ if (c >= 'A' && c <= 'F')
+ digit = c - 'A' + 10;
+ else if (c >= 'a' && c <= 'f')
digit = c - 'a' + 10;
- else if (c >= 'A')
- digit = c - 'A' + 10;
- }
- else
+ else
+ break;
+ } else
break;
db_tok_number = db_tok_number * r + digit;
c = db_read_char();
Home |
Main Index |
Thread Index |
Old Index