findutils-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Findutils-patches] [PATCH 1/5] Adopt the use of the gnulib module d-typ


From: James Youngman
Subject: [Findutils-patches] [PATCH 1/5] Adopt the use of the gnulib module d-type.
Date: Thu, 8 Apr 2010 02:44:50 +0100

* import-gnulib.config (modules): Import the d-type module.
* configure.ac: Remove old struct dirent.d_type detection logic
(since we now use the gnulib macro from the d-type module for
this).
* find/parser.c (parse_version): Use HAVE_STRUCT_DIRENT_D_TYPE
(since the d-ino module still defines it) but remove references to
the macro USE_STRUCT_DIRENT_D_TYPE, since it's not defined and not
needed.
* lib/savedirinfo.c: Use HAVE_STRUCT_DIRENT_D_TYPE but ignore
USE_STRUCT_DIRENT_D_TYPE.
(xsavedir): Unconditionally initialise
internal[result->size].type_info so that we don't have untested
code (HAVE_STRUCT_DIRENT_D_TYPE is defined on my system).

Signed-off-by: James Youngman <address@hidden>
---
 ChangeLog            |   15 +++++++++++++++
 configure.ac         |   15 ---------------
 find/parser.c        |    2 +-
 import-gnulib.config |   10 +++++++---
 lib/savedirinfo.c    |   22 +++-------------------
 5 files changed, 26 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index af42fb0..b6b8b52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2010-04-08  James Youngman  <address@hidden>
 
+       Adopt the use of the gnulib module d-type.
+       * import-gnulib.config (modules): Import the d-type module.
+       * configure.ac: Remove old struct dirent.d_type detection logic
+       (since we now use the gnulib macro from the d-type module for
+       this).
+       * find/parser.c (parse_version): Use HAVE_STRUCT_DIRENT_D_TYPE
+       (since the d-ino module still defines it) but remove references to
+       the macro USE_STRUCT_DIRENT_D_TYPE, since it's not defined and not
+       needed.
+       * lib/savedirinfo.c: Use HAVE_STRUCT_DIRENT_D_TYPE but ignore
+       USE_STRUCT_DIRENT_D_TYPE.
+       (xsavedir): Unconditionally initialise
+       internal[result->size].type_info so that we don't have untested
+       code (HAVE_STRUCT_DIRENT_D_TYPE is defined on my system).
+
        Move on from 4.5.8.
        * configure.ac: Bump the version number to 4.5.9-git.
        * NEWS: Likewise.
diff --git a/configure.ac b/configure.ac
index ba7035f..a7c48f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,21 +148,6 @@ AC_CHECK_MEMBERS([struct stat.st_rdev])
 dnl fdleak.c uses PROMOTED_MODE_T, which is defined by gnulib.
 gl_PROMOTED_TYPE_MODE_T
 
-AC_MSG_CHECKING([whether we should use struct dirent.d_type, if available])
-if test x$ac_cv_d_type = xno; then
-   AC_MSG_RESULT([no])
-else
-   AC_MSG_RESULT([yes])
-   AC_DEFINE([USE_STRUCT_DIRENT_D_TYPE], 1,
-   [Defined if you specify --enable-d_type-optimisation to configure.])
-   AC_CHECK_MEMBERS([struct dirent.d_type],[
-   AC_DEFINE([HAVE_STRUCT_DIRENT_D_TYPE], 1,
-   [Define to 1 if your 'struct dirent' has a d_type member])],
-   [],[
-#include <sys/types.h>
-#include <dirent.h>])
-fi
-
 
 AC_STRUCT_TM
 AC_STRUCT_TIMEZONE
diff --git a/find/parser.c b/find/parser.c
index f29f58b..ffdbf9c 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2709,7 +2709,7 @@ parse_version (const struct parser_table* entry, char 
**argv, int *arg_ptr)
   printf ("DEBUG_STAT ");
   ++features;
 #endif
-#if defined USE_STRUCT_DIRENT_D_TYPE && defined HAVE_STRUCT_DIRENT_D_TYPE
+#if defined HAVE_STRUCT_DIRENT_D_TYPE
   printf ("D_TYPE ");
   ++features;
 #endif
diff --git a/import-gnulib.config b/import-gnulib.config
index e0010bb..519252d 100644
--- a/import-gnulib.config
+++ b/import-gnulib.config
@@ -24,9 +24,6 @@ maintainer-makefile
 update-copyright
 '
 
-# consider using autobuild
-# consider using d-ino
-# consider using d-type
 # consider using dirent-safer
 # consider using do-release-commit-and-tag
 # consider using faccessat
@@ -53,6 +50,12 @@ update-copyright
 # We have rpmatch, either use it for -ok and xargs or remove the dependency
 # use fileblocks, filemode properly.
 
+# Things for later perhaps:
+# consider using d-ino (we currently don't use dirent.d_ino)
+
+# Considered, but no:
+# consider using autobuild (the information is not usually interesting for us)
+
 # Modules needed for findutils.
 # We need regex to ensure that we can build on platforms like
 # Solaris which lack those functions.
@@ -68,6 +71,7 @@ cloexec
 closein
 closeout
 ctype
+d-type
 dirname
 errno
 error
diff --git a/lib/savedirinfo.c b/lib/savedirinfo.c
index 928554c..0945058 100644
--- a/lib/savedirinfo.c
+++ b/lib/savedirinfo.c
@@ -64,21 +64,7 @@
 #include "extendbuf.h"
 #include "savedirinfo.h"
 
-/* In order to use struct dirent.d_type, it has to be enabled on the
- * configure command line, and we have to have a d_type member in
- * 'struct dirent'.
- */
-#if !defined(USE_STRUCT_DIRENT_D_TYPE)
-/* Not enabled, hence pretend it is absent. */
-#undef HAVE_STRUCT_DIRENT_D_TYPE
-#endif
-#if !defined(HAVE_STRUCT_DIRENT_D_TYPE)
-/* Not present, so cannot use it. */
-#undef USE_STRUCT_DIRENT_D_TYPE
-#endif
-
-
-#if defined HAVE_STRUCT_DIRENT_D_TYPE && defined USE_STRUCT_DIRENT_D_TYPE
+#if defined HAVE_STRUCT_DIRENT_D_TYPE
 /* Convert the value of struct dirent.d_type into a value for
  * struct stat.st_mode (at least the file type bits), or zero
  * if the type is DT_UNKNOWN or is a value we don't know about.
@@ -113,7 +99,6 @@ type_to_mode (unsigned type)
       return 0;                        /* Unknown. */
     }
 }
-
 #endif
 
 struct new_savedir_direntry_internal
@@ -196,12 +181,11 @@ xsavedir (const char *dir, int flags)
          internal = xextendbuf (internal, (1+result->size)*sizeof (*internal), 
&entrybuf_allocated);
          internal[result->size].flags = 0;
 
-#if defined HAVE_STRUCT_DIRENT_D_TYPE && defined USE_STRUCT_DIRENT_D_TYPE
+         internal[result->size].type_info = 0;
+#if defined HAVE_STRUCT_DIRENT_D_TYPE
          internal[result->size].type_info = type_to_mode (dp->d_type);
          if (dp->d_type != DT_UNKNOWN)
            internal[result->size].flags |= SavedirHaveFileType;
-#else
-         internal[result->size].type_info = 0;
 #endif
          internal[result->size].buffer_offset = namebuf_used;
 
-- 
1.7.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]