bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 7/8] fts: move decl of "dp" into while loop; split long line


From: Jim Meyering
Subject: [PATCH 7/8] fts: move decl of "dp" into while loop; split long line
Date: Thu, 18 Aug 2011 15:53:26 +0200

From: Jim Meyering <address@hidden>

---
 lib/fts.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/fts.c b/lib/fts.c
index 9e935ba..48919f7 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1229,7 +1229,6 @@ static FTSENT *
 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 @@ fts_build (register FTS *sp, int type)

         /* 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;

-- 
1.7.6.857.gf34cf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]