bug-findutils
[Top][All Lists]
Advanced

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

[PATCH] Remove some unused or dead code.


From: James Youngman
Subject: [PATCH] Remove some unused or dead code.
Date: Sun, 11 Apr 2010 11:02:20 +0100

* find/util.c (hook_fstatat): This has disabled and unused for a
long time, delete it.
* find/find.c (process_dir): Remove some unused debug code.
* find/tree.c (predlist_insert): Remove some dead code.
* lib/fdleak.c (complain_about_leaky_fds): Remove some unused
debug code.

Signed-off-by: James Youngman <address@hidden>
---
 ChangeLog    |   10 ++++++++++
 find/find.c  |    8 +-------
 find/tree.c  |   11 -----------
 find/util.c  |   47 -----------------------------------------------
 lib/fdleak.c |    7 -------
 5 files changed, 11 insertions(+), 72 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 931936d..23a066d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-04-11  James Youngman  <address@hidden>
+
+       Remove some unused or dead code.
+       * find/util.c (hook_fstatat): This has disabled and unused for a
+       long time, delete it.
+       * find/find.c (process_dir): Remove some unused debug code.
+       * find/tree.c (predlist_insert): Remove some dead code.
+       * lib/fdleak.c (complain_about_leaky_fds): Remove some unused
+       debug code.
+
 2010-04-10  James Youngman  <address@hidden>
 
        * import-gnulib.config (gnulib_version): Update to current gnulib
diff --git a/find/find.c b/find/find.c
index 30a2c34..2a9a327 100644
--- a/find/find.c
+++ b/find/find.c
@@ -1295,13 +1295,7 @@ process_dir (char *pathname, char *name, int pathlen, 
const struct stat *statp,
   struct stat stat_buf;
   size_t dircount = 0u;
   struct savedir_dirinfo *dirinfo;
-#if 0
-  printf ("process_dir: pathname=%s name=%s statp->st_nlink=%d st_ino=%d\n",
-         pathname,
-         name,
-         (int)statp->st_nlink,
-         (int)statp->st_ino);
-#endif
+
   if (statp->st_nlink < 2)
     {
       subdirs_unreliable = true;
diff --git a/find/tree.c b/find/tree.c
index 4417b4c..55ba8cc 100644
--- a/find/tree.c
+++ b/find/tree.c
@@ -345,17 +345,6 @@ predlist_insert (struct predlist *list,
   struct predicate **insertpos = &(list->head);
 
   *pprev = curr->pred_left;
-  if (options.optimisation_level > 2)
-    {
-      /* Insert the new node in the list after any other entries which
-       * are more selective.
-       */
-      if (0)
-       while ( (*insertpos) && ((*insertpos)->est_success_rate < 
curr->est_success_rate) )
-         {
-           insertpos = &((*insertpos)->pred_left);
-         }
-    }
   curr->pred_left = (*insertpos);
   (*insertpos) = curr;
   if (NULL == list->tail)
diff --git a/find/util.c b/find/util.c
index 880e99a..013e63f 100644
--- a/find/util.c
+++ b/find/util.c
@@ -488,53 +488,6 @@ cleanup (void)
     nonfatal_nontarget_file_error (errno, "standard output");
 }
 
-/* Savannah bug #16378 manifests as an assertion failure in pred_type()
- * when an NFS server returns st_mode with value 0 (of course the stat(2)
- * system call is itself returning 0 in this case).
- */
-#undef DEBUG_SV_BUG_16378
-#if defined DEBUG_SV_BUG_16378
-static int hook_fstatat (int fd, const char *name, struct stat *p, int flags)
-{
-  static int warned = 0;
-
-  if (!warned)
-    {
-      /* No use of _() here; no point asking translators to translate a debug 
msg */
-      error (0, 0,
-            "WARNING: some debug code is enabled for Savannah bug #16378; "
-            "this should not occur in released versions of findutils!");
-      warned = 1;
-    }
-
-  if (0 == strcmp (name, "./mode0file")
-      || 0 == strcmp (name, "mode0file"))
-    {
-      time_t now = time (NULL);
-      long day = 86400;
-
-      p->st_rdev = 0;
-      p->st_dev = 0x300;
-      p->st_ino = 0;
-      p->st_mode = 0;          /* SV bug #16378 */
-      p->st_nlink = 1;
-      p->st_uid = geteuid ();
-      p->st_gid = 0;
-      p->st_size = 42;
-      p->st_blksize = 32768;
-      p->st_atime = now-1*day;
-      p->st_mtime = now-2*day;
-      p->st_ctime = now-3*day;
-
-      return 0;
-    }
-  return fstatat (fd, name, p, flags);
-}
-
-# undef  fstatat
-# define fstatat (fd,name,p,flags) hook_fstatat((fd),(name),(p),(flags))
-#endif
-
 
 static int
 fallback_stat (const char *name, struct stat *p, int prev_rv)
diff --git a/lib/fdleak.c b/lib/fdleak.c
index 47f9579..d25c9c1 100644
--- a/lib/fdleak.c
+++ b/lib/fdleak.c
@@ -383,13 +383,6 @@ complain_about_leaky_fds (void)
               "remembering to include a detailed description of the simplest "
               "way to reproduce this problem."),
             leaking_fd);
-      if (0)
-       {
-         char * const args[] = {"/bin/ls", "-l", "/proc/self/fd",
-                                (char*)NULL };
-         execv ("/bin/ls", args);
-         perror ("exec");
-       }
     }
   assert (no_leaks);
 }
-- 
1.7.0





reply via email to

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