bug-findutils
[Top][All Lists]
Advanced

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

[PATCH 3/3] Fix compile-time warnings.


From: Kamil Dudka
Subject: [PATCH 3/3] Fix compile-time warnings.
Date: Sun, 3 Feb 2013 23:07:42 +0100

* find/defs.h (struct predicate): Add a missing const modifier.
* find/exec.c (launch): Add explicit type-cast.
* find/find.c (wd_sanity_check): Suppress a warning in #else branch.
(process_dir): Remove an unused variables and statements.
* find/pred.c (pred_context): Use const modifier in the prototype.
* xargs/xargs.c (main): Add explicit type-casts.
(xargs_do_exec): Likewise.
---
 ChangeLog     |    9 +++++++++
 find/defs.h   |    2 +-
 find/exec.c   |    2 +-
 find/find.c   |   14 +-------------
 find/pred.c   |    2 +-
 xargs/xargs.c |    4 ++--
 6 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d7476d5..e56e289 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2013-02-03  Kamil Dudka  <address@hidden>
 
+       Fix compile-time warnings.
+       * find/defs.h (struct predicate): Add a missing const modifier.
+       * find/exec.c (launch): Add explicit type-cast.
+       * find/find.c (wd_sanity_check): Suppress a warning in #else branch.
+       (process_dir): Remove an unused variables and statements.
+       * find/pred.c (pred_context): Use const modifier in the prototype.
+       * xargs/xargs.c (main): Add explicit type-casts.
+       (xargs_do_exec): Likewise.
+
        Avoid using 'INCLUDES =' in automake templates.
        * find/Makefile.am: Use AM_CPPFLAGS instead of deprecated INCLUDES.
        * lib/Makefile.am: Likewise.
diff --git a/find/defs.h b/find/defs.h
index ca7d604..caccd2b 100644
--- a/find/defs.h
+++ b/find/defs.h
@@ -258,7 +258,7 @@ struct predicate
 
   /* Only used for debugging, but defined unconditionally so individual
      modules can be compiled with -DDEBUG.  */
-  char *p_name;
+  const char *p_name;
 
   /* The type of this node.  There are two kinds.  The first is real
      predicates ("primaries") such as -perm, -print, or -exec.  The
diff --git a/find/exec.c b/find/exec.c
index aa69fe3..f731d82 100644
--- a/find/exec.c
+++ b/find/exec.c
@@ -324,7 +324,7 @@ launch (struct buildcmd_control *ctl, void *usercontext, 
int argc, char **argv)
            }
        }
 
-      if (bc_args_exceed_testing_limit (argv))
+      if (bc_args_exceed_testing_limit ((const char **) argv))
        errno = E2BIG;
       else
        execvp (argv[0], argv);
diff --git a/find/find.c b/find/find.c
index 5d287b5..00a2a6c 100644
--- a/find/find.c
+++ b/find/find.c
@@ -528,6 +528,7 @@ wd_sanity_check (const char *thing_to_stat,
 #ifdef STAT_MOUNTPOINTS
          isfatal = dirchange_is_fatal (specific_what,isfatal,silent,newinfo);
 #else
+      (void) silent;
          isfatal = RETRY_IF_SANITY_CHECK_FAILS;
 #endif
        }
@@ -1302,7 +1303,6 @@ process_dir (char *pathname, char *name, int pathlen, 
const struct stat *statp,
 {
   int subdirs_left;            /* Number of unexamined subdirs in PATHNAME. */
   bool subdirs_unreliable;     /* if true, cannot use dir link count as subdir 
limif (if false, it may STILL be unreliable) */
-  unsigned int idx;            /* Which entry are we on? */
   struct stat stat_buf;
   size_t dircount = 0u;
   DIR *dirp;
@@ -1519,7 +1519,6 @@ process_dir (char *pathname, char *name, int pathlen, 
const struct stat *statp,
       if (strcmp (name, "."))
        {
          enum SafeChdirStatus status;
-         struct dir_id did;
 
          /* We could go back and do the next command-line arg
             instead, maybe using longjmp.  */
@@ -1555,17 +1554,6 @@ process_dir (char *pathname, char *name, int pathlen, 
const struct stat *statp,
                     "%s", safely_quote_err_filename (0, pathname));
              return;
            }
-
-         if (dir_curr > 0)
-           {
-             did.dev = dir_ids[dir_curr-1].dev;
-             did.ino = dir_ids[dir_curr-1].ino;
-           }
-         else
-           {
-             did.dev = starting_stat_buf.st_dev;
-             did.ino = starting_stat_buf.st_ino;
-           }
        }
 
       free (cur_path);
diff --git a/find/pred.c b/find/pred.c
index 88dacd9..e9c9a49 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -1216,7 +1216,7 @@ pred_context (const char *pathname, struct stat *stat_buf,
    Return BUF. */
 
 static char *
-blank_rtrim (char *str, char *buf)
+blank_rtrim (const char *str, char *buf)
 {
   int i;
 
diff --git a/xargs/xargs.c b/xargs/xargs.c
index 5fd93cd..22a8b18 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -554,7 +554,7 @@ main (int argc, char **argv)
                error (0, 0,
                       _("warning: value %ld for -s option is too large, "
                         "using %ld instead"),
-                      arg_size, bc_ctl.posix_arg_size_max);
+                      (long) arg_size, (long) bc_ctl.posix_arg_size_max);
                arg_size = bc_ctl.posix_arg_size_max;
              }
            bc_ctl.arg_max = arg_size;
@@ -1208,7 +1208,7 @@ xargs_do_exec (struct buildcmd_control *ctl, void 
*usercontext, int argc, char *
 
            prep_child_for_exec ();
 
-           if (bc_args_exceed_testing_limit (argv))
+           if (bc_args_exceed_testing_limit ((const char **) argv))
              errno = E2BIG;
            else
              execvp (argv[0], argv);
-- 
1.7.1




reply via email to

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