changeset 30173:2e352dbac4af

fts: tweak inode comparison function * lib/fts.c (fts_compare_ino): Sort on increasing, not decreasing inode numbers, as documented. SCALAR(0xeb1b20)
author Jim Meyering <meyering@redhat.com>
date Fri, 26 Sep 2008 13:43:00 +0200
parents b76e9423366a
children be50cfde3f08
files ChangeLog lib/fts.c
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 16 10:05:47 2008 +0200
+++ b/ChangeLog	Fri Sep 26 13:43:00 2008 +0200
@@ -1,5 +1,9 @@
 2008-09-26  Jim Meyering  <meyering@redhat.com>
 
+	fts: tweak inode comparison function
+	* lib/fts.c (fts_compare_ino): Sort on increasing, not decreasing
+	inode numbers, as documented.
+
 	fts: sort dirent entries on inode number before traversing
 	This avoids a quadratic, seek-related performance penalty when
 	operating on a directory containing many entries (measurable at 10k;
@@ -12,6 +16,7 @@
 	(dirent_inode_sort_may_be_useful, fts_compare_ino): Likewise.
 	(fts_build): Set the stat.st_ino member from D_INO.
 	If it is likely to be useful, sort dirent entries on inode number.
+
 	* m4/fts.m4 (gl_FUNC_FTS_CORE): Check for fstatfs, sys/vfs.h,
 	and the struct statfs.f_type member.
 	* modules/fts (Depends-on): Add d-ino.
--- a/lib/fts.c	Tue Sep 16 10:05:47 2008 +0200
+++ b/lib/fts.c	Fri Sep 26 13:43:00 2008 +0200
@@ -981,8 +981,8 @@
 static int
 fts_compare_ino (struct _ftsent const **a, struct _ftsent const **b)
 {
-  return (a[0]->fts_statp->st_ino < b[0]->fts_statp->st_ino ? 1
-	  : b[0]->fts_statp->st_ino < a[0]->fts_statp->st_ino ? -1 : 0);
+  return (a[0]->fts_statp->st_ino < b[0]->fts_statp->st_ino ? -1
+	  : b[0]->fts_statp->st_ino < a[0]->fts_statp->st_ino ? 1 : 0);
 }
 
 /*