]> Savannah Git Hosting - gnulib.git/commitdiff
fts: omit goto break_without_closedir
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Dec 2022 18:03:56 +0000 (10:03 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Dec 2022 18:42:45 +0000 (10:42 -0800)
* lib/fts.c (fts_build): Refactor to omit goto.

ChangeLog
lib/fts.c

index 08436174d73a2ee6f62a8e223b9f51c79964577d..54e3a234577cf2df8dda0f00823d419209d98702 100644 (file)
--- 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.
 
index 8d2a5d2d906b1c83cfdc8a87e1f5c024dcdff3b7..27354d39c8a960b748fed8b85d34583a3d1d554b 100644 (file)
--- 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.