[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] fts: omit goto break_without_closedir
From: |
Paul Eggert |
Subject: |
[PATCH 2/3] fts: omit goto break_without_closedir |
Date: |
Tue, 6 Dec 2022 10:43:58 -0800 |
* lib/fts.c (fts_build): Refactor to omit goto.
---
ChangeLog | 3 +++
lib/fts.c | 8 ++------
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 08436174d7..54e3a23457 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2022-12-06 Paul Eggert <eggert@cs.ucla.edu>
+ fts: omit goto break_without_closedir
+ * lib/fts.c (fts_build): Refactor to omit goto.
+
fts: clarify ISSET
* lib/fts.c (ISSET): Refactor to clarify boolean usage.
diff --git a/lib/fts.c b/lib/fts.c
index 8d2a5d2d90..27354d39c8 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1433,6 +1433,7 @@ fts_build (register FTS *sp, int type)
cur->fts_info = (continue_readdir || nitems)
? FTS_ERR : FTS_DNR;
}
+ closedir_and_clear(cur->fts_dirp);
break;
}
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
@@ -1553,15 +1554,10 @@ mem1: saved_errno = errno;
/* When there are too many dir entries, leave
fts_dirp open, so that a subsequent fts_read
can take up where we leave off. */
- goto break_without_closedir;
+ break;
}
}
- if (cur->fts_dirp)
- closedir_and_clear(cur->fts_dirp);
-
- break_without_closedir:
-
/*
* If realloc() changed the address of the file name, adjust the
* addresses for the rest of the tree and the dir list.
--
2.38.1