]> Savannah Git Hosting - gnulib.git/commitdiff
fts: avoid unnecessary strlen calls
authorEric Blake <eblake@redhat.com>
Wed, 9 Apr 2014 16:20:08 +0000 (10:20 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 9 Apr 2014 16:20:08 +0000 (10:20 -0600)
Not all platforms have _D_EXACT_NAMLEN.

* lib/fts.c (_D_EXACT_NAMLEN): Restore definition when needed.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/fts.c

index fb2f7a1e4ab8cdeb91c2f1b102734431caef6f5f..381b269b0b1e807eed51b60482f324f6da4867ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-09  Eric Blake  <eblake@redhat.com>
+
+       fts: avoid unnecessary strlen calls
+       * lib/fts.c (_D_EXACT_NAMLEN): Restore definition when needed.
+
 2014-04-09  Paul Eggert  <eggert@cs.ucla.edu>
 
        fts: avoid unnecessary strlen calls
index 992bbad777b300fd76c7607584d76cec2fea72bc..500e92c6b8d2863d8677a6bef426bbff14439486 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -79,6 +79,9 @@ static char sccsid[] = "@(#)fts.c       8.6 (Berkeley) 8/14/94";
 #endif
 
 #include <dirent.h>
+#ifndef _D_EXACT_NAMLEN
+# define _D_EXACT_NAMLEN(dirent) strlen ((dirent)->d_name)
+#endif
 
 #if HAVE_STRUCT_DIRENT_D_TYPE
 /* True if the type of the directory entry D is known.  */