about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2005-10-31 18:22:40 +0000
committerWayne Davison <wayned@users.sourceforge.net>2005-10-31 18:22:40 +0000
commit87f010ec1ab3fdff909370efd9dbca635105471a (patch)
tree4b5273aa29d42e280e9544d115b2c19c7c99adda /Src/Modules
parent8c3234fb738b56cb8e087681fd8cf82aeac5046b (diff)
downloadzsh-87f010ec1ab3fdff909370efd9dbca635105471a.tar.gz
zsh-87f010ec1ab3fdff909370efd9dbca635105471a.tar.xz
zsh-87f010ec1ab3fdff909370efd9dbca635105471a.zip
Use idigit() instead of range-checking '0' - '9'.
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/files.c2
-rw-r--r--Src/Modules/mathfunc.c2
-rw-r--r--Src/Modules/zutil.c11
3 files changed, 7 insertions, 8 deletions
diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index bb1cc0065..331507c64 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -605,7 +605,7 @@ static unsigned long getnumeric(char *p, int *errp)
 {
     unsigned long ret;
 
-    if(*p < '0' || *p > '9') {
+    if (!idigit(*p)) {
 	*errp = 1;
 	return 0;
     }
diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c
index 6b6488abb..7b9b10fab 100644
--- a/Src/Modules/mathfunc.c
+++ b/Src/Modules/mathfunc.c
@@ -503,7 +503,7 @@ math_string(UNUSED(char *name), char *arg, int id)
 			unsigned short *seedptr = seedbufptr + i;
 			*seedptr = 0;
 			for (j = 0; j < 4; j++) {
-			    if (*seedstr >= '0' && *seedstr <= '9')
+			    if (idigit(*seedstr))
 				*seedptr += *seedstr - '0';
 			    else if (tolower(*seedstr) >= 'a' &&
 				     tolower(*seedstr) <= 'f')
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index 9b81ba92e..c88e66288 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -573,8 +573,8 @@ static char *zformat_substring(char* instr, char **specs, char **outp,
 	    if ((right = (*++s == '-')))
 		s++;
 
-	    if (*s >= '0' && *s <= '9') {
-		for (min = 0; *s >= '0' && *s <= '9'; s++)
+	    if (idigit(*s)) {
+		for (min = 0; idigit(*s); s++)
 		    min = (min * 10) + (int) STOUC(*s) - '0';
 	    }
 
@@ -586,8 +586,8 @@ static char *zformat_substring(char* instr, char **specs, char **outp,
 		right = 1;
 		s++;
 	    }
-	    if ((*s == '.' || testit) && s[1] >= '0' && s[1] <= '9') {
-		for (max = 0, s++; *s >= '0' && *s <= '9'; s++)
+	    if ((*s == '.' || testit) && idigit(s[1])) {
+		for (max = 0, s++; idigit(*s); s++)
 		    max = (max * 10) + (int) STOUC(*s) - '0';
 	    }
 	    else if (testit)
@@ -714,8 +714,7 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
 	    specs[')'] = ")";
 	    for (ap = args + 2; *ap; ap++) {
 		if (!ap[0][0] || ap[0][0] == '-' || ap[0][0] == '.' ||
-		    (ap[0][0] >= '0' && ap[0][0] <= '9') ||
-		    ap[0][1] != ':') {
+		    idigit(ap[0][0]) || ap[0][1] != ':') {
 		    zwarnnam(nam, "invalid argument: %s", *ap, 0);
 		    return 1;
 		}