]> Dogcows Code - chaz/tar/commitdiff
tar: remove lint
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 11 Mar 2012 20:00:52 +0000 (13:00 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 11 Mar 2012 20:01:51 +0000 (13:01 -0700)
This lint was found by GCC 4.6.2 on Fedora 15 x86-64.
* src/buffer.c (buffer_write_global_xheader, mv_end, set_start_time)
(compute_duration, print_total_stats, flush_read, flush_write):
* src/checkpoint.c (checkpoint_finish_compile):
* src/list.c (test_archive_label):
* src/misc.c (chdir_count):
* src/names.c (const):
* src/unlink.c (finish_deferred_unlinks):
Define with (void) instead of with (), for slightly-better C type
checking and to avoid a GCC warning.
* src/compare.c (diff_dumpdir):
* src/tar.c (parse_owner_group): Remove unused local.
* src/misc.c (chdir_do):
* src/tar.c (add_exclude_array): Rename local to avoid shadowing.
(LOW_DENSITY_NUM, MID_DENSITY_NUM, HIGH_DENSITY_NUM):
Define only if needed.
* src/update.c (update_archive): Initialize a local; this fixes
what appears to be a real bug.

src/buffer.c
src/checkpoint.c
src/compare.c
src/list.c
src/misc.c
src/names.c
src/tar.c
src/unlink.c
src/update.c

index 4a980b5da373725385db98a481aa66c38a77541a..7638bb1fce71c3e0ffc14b48480b6c5692e9a965 100644 (file)
@@ -193,7 +193,7 @@ bufmap_reset (struct bufmap *map, ssize_t fixup)
 static struct tar_stat_info dummy;
 
 void
-buffer_write_global_xheader ()
+buffer_write_global_xheader (void)
 {
   xheader_write_global (&dummy.xhdr);
 }
@@ -205,7 +205,7 @@ mv_begin_read (struct tar_stat_info *st)
 }
 
 void
-mv_end ()
+mv_end (void)
 {
   if (multi_volume_option)
     bufmap_free (NULL);
@@ -233,7 +233,7 @@ clear_read_error_count (void)
 double duration;
 
 void
-set_start_time ()
+set_start_time (void)
 {
   gettime (&start_time);
   volume_start_time = start_time;
@@ -248,7 +248,7 @@ set_volume_start_time (void)
 }
 
 void
-compute_duration ()
+compute_duration (void)
 {
   struct timespec now;
   gettime (&now);
@@ -509,7 +509,7 @@ print_stats (FILE *fp, const char *text, tarlong numbytes)
 }
 
 void
-print_total_stats ()
+print_total_stats (void)
 {
   switch (subcommand_option)
     {
@@ -1928,13 +1928,13 @@ gnu_flush_write (size_t buffer_level)
 }
 
 void
-flush_read ()
+flush_read (void)
 {
   flush_read_ptr ();
 }
 
 void
-flush_write ()
+flush_write (void)
 {
   flush_write_ptr (record_size);
 }
index f2f17a2d4894e2e9af1b824c21f7f683d86403ec..eb83cd319137bd562d801c6ebe122407a64443fd 100644 (file)
@@ -113,7 +113,7 @@ checkpoint_compile_action (const char *str)
 }
 
 void
-checkpoint_finish_compile ()
+checkpoint_finish_compile (void)
 {
   if (checkpoint_option)
     {
index 2fc72b73a0357d517da4bd3bf214a490adf3ec63..ea41cb35090aadbbc52d9fdc10ff9eef57ffe13d 100644 (file)
@@ -362,7 +362,6 @@ static void
 diff_dumpdir (struct tar_stat_info *dir)
 {
   const char *dumpdir_buffer;
-  dev_t dev = 0;
   struct stat stat_data;
 
   if (deref_stat (dir->file_name, &stat_data) != 0)
@@ -372,8 +371,6 @@ diff_dumpdir (struct tar_stat_info *dir)
       else
        stat_error (dir->file_name);
     }
-  else
-    dev = stat_data.st_dev;
 
   if (dir->fd == 0)
     {
index 7e1319c79ce67d94218e24203120d0e212a85987..4f85fb5b9f0b2a099ef53ca302239462245bde5f 100644 (file)
@@ -1415,7 +1415,7 @@ skip_member (void)
 }
 
 void
-test_archive_label ()
+test_archive_label (void)
 {
   base64_init ();
   name_gather ();
index 126161b4a037878f603a6a7299eddea4be10926f..734dc4eded7adcac4f7a29d84111a0d49306cfb4 100644 (file)
@@ -713,7 +713,7 @@ static int wdcache[CHDIR_CACHE_SIZE];
 static size_t wdcache_count;
 
 int
-chdir_count ()
+chdir_count (void)
 {
   if (wd_count == 0)
     return wd_count;
@@ -814,11 +814,11 @@ chdir_do (int i)
          int prev = wdcache[0];
          for (ci = 1; prev != i; ci++)
            {
-             int curr = wdcache[ci];
+             int cur = wdcache[ci];
              wdcache[ci] = prev;
-             if (curr == i)
+             if (cur == i)
                break;
-             prev = curr;
+             prev = cur;
            }
          wdcache[0] = i;
        }
index f533c08736241ec4cc6a6ed67e0dfc3e2dbf4c79..eee6bde928d99c99a1766f9315b3ac3cfda58e24 100644 (file)
@@ -1100,7 +1100,7 @@ name_scan (const char *file_name)
 struct name *gnu_list_name;
 
 struct name const *
-name_from_list ()
+name_from_list (void)
 {
   if (!gnu_list_name)
     gnu_list_name = namelist;
index 4f6853486816feddba66eb4f2e87346d12ba5988..ec7ebabb356622aa7a6a944c79223279671ae4d7 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -897,12 +897,12 @@ static char const * const backup_file_table[] = {
 };
 
 static void
-add_exclude_array (char const * const * fv, int options)
+add_exclude_array (char const * const * fv, int opts)
 {
   int i;
 
   for (i = 0; fv[i]; i++)
-    add_exclude (excluded, fv[i], options);
+    add_exclude (excluded, fv[i], opts);
 }
 
 \f
@@ -1152,16 +1152,18 @@ add_file_id (const char *filename)
 
 /* Default density numbers for [0-9][lmh] device specifications */
 
-#ifndef LOW_DENSITY_NUM
-# define LOW_DENSITY_NUM 0
-#endif
+#if defined DEVICE_PREFIX && !defined DENSITY_LETTER
+# ifndef LOW_DENSITY_NUM
+#  define LOW_DENSITY_NUM 0
+# endif
 
-#ifndef MID_DENSITY_NUM
-# define MID_DENSITY_NUM 8
-#endif
+# ifndef MID_DENSITY_NUM
+#  define MID_DENSITY_NUM 8
+# endif
 
-#ifndef HIGH_DENSITY_NUM
-# define HIGH_DENSITY_NUM 16
+# ifndef HIGH_DENSITY_NUM
+#  define HIGH_DENSITY_NUM 16
+# endif
 #endif
 
 static void
@@ -1375,7 +1377,6 @@ expand_pax_option (struct tar_args *targs, const char *arg)
 static uintmax_t
 parse_owner_group (char *arg, uintmax_t field_max, char const **name_option)
 {
-  strtol_error err;
   uintmax_t u = UINTMAX_MAX;
   char *end;
   char const *name = 0;
index b2816368569c85140f972fdc45bcb5664021c5d4..522ae118ca3cb2adb5ca0be9413157a7e4dcd25e 100644 (file)
@@ -123,7 +123,7 @@ flush_deferred_unlinks (bool force)
 }
 
 void
-finish_deferred_unlinks ()
+finish_deferred_unlinks (void)
 {
   flush_deferred_unlinks (true);
   while (dunlink_avail)
index e3228d425f51d90d5a841e9aefa984cec1a69a30..17f9e052047e91859f3afc29da8132d09cf6bd64 100644 (file)
@@ -145,7 +145,7 @@ update_archive (void)
                    if (S_ISDIR (s.st_mode))
                      {
                        char *p, *dirp;
-                       DIR *stream;
+                       DIR *stream = NULL;
                        int fd = openat (chdir_fd, name->name,
                                         open_read_flags | O_DIRECTORY);
                        if (fd < 0)
This page took 0.030752 seconds and 4 git commands to generate.