]> Savannah Git Hosting - gnulib.git/commitdiff
fts: port to C89
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 10 Nov 2014 23:43:22 +0000 (15:43 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 10 Nov 2014 23:44:02 +0000 (15:44 -0800)
Problem reported for MSVC 16 by Gisle Vanem in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-11/msg00027.html
* lib/fts.c (fts_build): Avoid declaration before statement.

ChangeLog
lib/fts.c

index 28dcc5f548baf72f8f22d81a1a41cd29b7e440fd..c95ca87b6d873ed74c521ee1d3caddf0ada490d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       fts: port to C89
+       Problem reported for MSVC 16 by Gisle Vanem in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2014-11/msg00027.html
+       * lib/fts.c (fts_build): Avoid declaration before statement.
+
 2014-11-06  Paul Eggert  <eggert@cs.ucla.edu>
 
        unistd: port to iOS
index 500e92c6b8d2863d8677a6bef426bbff14439486..9851c53104c26f5f821e6cc723023763d360bea4 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1293,6 +1293,7 @@ fts_build (register FTS *sp, int type)
         int dir_fd;
         FTSENT *cur = sp->fts_cur;
         bool continue_readdir = !!cur->fts_dirp;
+        size_t max_entries;
 
         /* When cur->fts_dirp is non-NULL, that means we should
            continue calling readdir on that existing DIR* pointer
@@ -1354,8 +1355,7 @@ fts_build (register FTS *sp, int type)
            function.  But when no such function is specified, we can read
            entries in batches that are large enough to help us with inode-
            sorting, yet not so large that we risk exhausting memory.  */
-        size_t max_entries = (sp->fts_compar == NULL
-                              ? FTS_MAX_READDIR_ENTRIES : SIZE_MAX);
+        max_entries = sp->fts_compar ? SIZE_MAX : FTS_MAX_READDIR_ENTRIES;
 
         /*
          * Nlinks is the number of possible entries of type directory in the