[Top][All Lists]
[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
- fts: do not exhaust memory when processing million-entry directory, Jim Meyering, 2011/08/18
- [PATCH 3/8] maint: fts.c: correct off-by-one indentation, Jim Meyering, 2011/08/18
- [PATCH 2/8] maint: fts.c: move __opendir2 #define "up" out of function body, Jim Meyering, 2011/08/18
- [PATCH 7/8] fts: move decl of "dp" into while loop; split long line,
Jim Meyering <=
- [PATCH 5/8] maint: fts: give __opendir2 a new parameter, Jim Meyering, 2011/08/18
- [PATCH 6/8] fts: add/use new struct member, fts_dirp, Jim Meyering, 2011/08/18
- [PATCH 8/8] fts: do not exhaust memory when processing million-entry directories, Jim Meyering, 2011/08/18
Re: fts: do not exhaust memory when processing million-entry directory, Pádraig Brady, 2011/08/18