Mercurial > hg > octave-kai > gnulib-hg
changeset 15530:ddc76c261e25
maint: fts: move decl of `dp' down into while loop; split a long line
* lib/fts.c (fts_build): No semantic change.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Wed, 17 Aug 2011 09:24:06 +0200 |
parents | 894e5e6ae541 |
children | 65fb6cc5f301 |
files | ChangeLog lib/fts.c |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-08-19 Jim Meyering <meyering@redhat.com> + maint: fts: move decl of `dp' down into while loop; split a long line + * lib/fts.c (fts_build): No semantic change. + fts: add/use new struct member, fts_dirp We are about to use this to manage any directory with too many entries to read all of them into memory at once.
--- a/lib/fts.c +++ b/lib/fts.c @@ -1229,7 +1229,6 @@ internal_function fts_build (register FTS *sp, int type) { - register struct dirent *dp; register FTSENT *p, *head; register size_t nitems; FTSENT *tail; @@ -1352,9 +1351,14 @@ /* Read the directory, attaching each entry to the `link' pointer. */ doadjust = false; - for (head = tail = NULL, nitems = 0; cur->fts_dirp && (dp = readdir(cur->fts_dirp));) { + head = NULL; + tail = NULL; + nitems = 0; + while (cur->fts_dirp) { bool is_dir; - + struct dirent *dp = readdir(cur->fts_dirp); + if (dp == NULL) + break; if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) continue;