summaryrefslogtreecommitdiff
path: root/lib/fts.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-04-11 16:27:03 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-04-11 16:27:25 -0700
commit1b47cef69f585d3b0fd2120419c0c9eb40fe0ceb (patch)
tree9318555738613ce2819a3f8f857d540fa8e5ed56 /lib/fts.c
parent81b8c0d3be98f5a77403599de3d06329b3e7673e (diff)
downloadgnulib-1b47cef69f585d3b0fd2120419c0c9eb40fe0ceb.tar.gz
fts: add comment
* lib/fts.c (fts_build): Explain why ==, not >. See remark by Bernhard Voelker in: https://lists.gnu.org/r/bug-gnulib/2018-04/msg00041.html
Diffstat (limited to 'lib/fts.c')
-rw-r--r--lib/fts.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/fts.c b/lib/fts.c
index a26c6824a0..d543510595 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1597,7 +1597,11 @@ mem1: saved_errno = errno;
/* If there are many entries, no sorting function has been
specified, and this file system is of a type that may be
slow with a large number of entries, arrange to sort the
- directory entries on increasing inode numbers. */
+ directory entries on increasing inode numbers.
+
+ The NITEMS comparison uses ==, not >, because the test
+ needs to be tried at most once once, and NITEMS will exceed
+ the threshold after it is incremented below. */
if (nitems == _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
&& !sp->fts_compar)
sort_by_inode = dirent_inode_sort_may_be_useful (cur, dir_fd);