Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libform PR 51190 David Binderman: simplify redundant con...
details: https://anonhg.NetBSD.org/src/rev/d309eee25624
branches: trunk
changeset: 345497:d309eee25624
user: dholland <dholland%NetBSD.org@localhost>
date: Mon May 30 17:48:29 2016 +0000
description:
PR 51190 David Binderman: simplify redundant conditionals.
Also add paranoia when looping on isdigit().
diffstat:
lib/libform/type_numeric.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (39 lines):
diff -r c942ab5c19c9 -r d309eee25624 lib/libform/type_numeric.c
--- a/lib/libform/type_numeric.c Mon May 30 17:45:26 2016 +0000
+++ b/lib/libform/type_numeric.c Mon May 30 17:48:29 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: type_numeric.c,v 1.8 2004/10/28 21:14:52 dsl Exp $ */
+/* $NetBSD: type_numeric.c,v 1.9 2016/05/30 17:48:29 dholland Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: type_numeric.c,v 1.8 2004/10/28 21:14:52 dsl Exp $");
+__RCSID("$NetBSD: type_numeric.c,v 1.9 2016/05/30 17:48:29 dholland Exp $");
#include <stdlib.h>
#include <string.h>
@@ -136,16 +136,15 @@
cur++;
/* if not at end of string then check for decimal... */
- if ((buf[cur] != '\0') && (buf[cur] == '.')) {
+ if (buf[cur] == '.') {
cur++;
- /* check for more digits now.... */
- while(isdigit((unsigned char)buf[cur]))
+ /* check for more digits now.... */
+ while (buf[cur] && isdigit((unsigned char)buf[cur]))
cur++;
}
/* check for an exponent */
- if ((buf[cur] != '\0') &&
- ((buf[cur] == 'E') || (buf[cur] == 'e'))) {
+ if ((buf[cur] == 'E') || (buf[cur] == 'e')) {
cur++;
if (buf[cur] == '\0')
return FALSE;
Home |
Main Index |
Thread Index |
Old Index