]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(EXT): Use size_t for sizes, not ptrdiff_t, so that we don't have
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2004 18:21:05 +0000 (18:21 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2004 18:21:05 +0000 (18:21 +0000)
to worry about wraparound.

lib/fnmatch_loop.c

index 6d627b233a91e98eeb56d0e1031d13d0bb8e45f1..7cea5a76ed1de8d57bda9656f35b463ad6911c14 100644 (file)
@@ -999,7 +999,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
      bool no_leading_period, int flags)
 {
   const CHAR *startp;
-  ptrdiff_t level;
+  size_t level;
   struct patternlist
   {
     struct patternlist *next;
@@ -1013,7 +1013,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
 
   /* Parse the pattern.  Store the individual parts in the list.  */
   level = 0;
-  for (startp = p = pattern + 1; level >= 0; ++p)
+  for (startp = p = pattern + 1; ; ++p)
     if (*p == L('\0'))
       /* This is an invalid pattern.  */
       return -1;
@@ -1066,6 +1066,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
            *lastp = newp;                                                    \
            lastp = &newp->next
            NEW_PATTERN;
+           break;
          }
       }
     else if (*p == L('|'))