(non_neg_strtol): Don't compare signed and unsigned.
authorJim Meyering <jim@meyering.net>
Mon, 12 Jun 1995 18:28:24 +0000 (18:28 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 12 Jun 1995 18:28:24 +0000 (18:28 +0000)
src/tr.c

index 8775613..474da3e 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -871,11 +871,16 @@ non_neg_strtol (s, len, val)
 
   for (i = 0; i < len; i++)
     {
-      int c = s[i] - '0';
+      unsigned int c;
 
-      if (c >= base || c < 0)
+      if (s[i] < '0')
        return 1;
-      if (i > 8 && sum > (LONG_MAX - c) / base)
+
+      c = s[i] - '0';
+      if (c >= base)
+       return 1;
+
+      if (sum > (LONG_MAX - c) / base)
        return 1;
       sum = sum * base + c;
     }