(__xstrtol): Change interpretation of
authorJim Meyering <jim@meyering.net>
Sat, 25 Jan 1997 06:13:46 +0000 (06:13 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 25 Jan 1997 06:13:46 +0000 (06:13 +0000)
VALID_SUFFIXES == NULL vs VALID_SUFFIXES == "".  Use the former
when any suffix is valid, the later when no suffix is allowed.

lib/xstrtol.c

index fea6c4801ae107b78c99e4f83a80942600031e9d..ad2bcdbf10fe7ae87b8ab7c54e2b6a1251e08945 100644 (file)
@@ -91,15 +91,14 @@ __xstrtol (s, ptr, base, val, valid_suffixes)
     return LONGINT_OVERFLOW;
   if (*p == s)
     return LONGINT_INVALID;
+
+  /* Let valid_suffixes == NULL mean `allow any suffix'.  */
+  /* FIXME: update all callers except the one in tail.c changing
+     last parameter NULL to `""'.  */
   if (!valid_suffixes)
     {
-      if (**p == '\0')
-       {
-         *val = tmp;
-         return LONGINT_OK;
-       }
-      else
-       return LONGINT_INVALID_SUFFIX_CHAR;
+      *val = tmp;
+      return LONGINT_OK;
     }
 
   if (**p != '\0')