Browse Source

tar: remove lint

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.
Paul Eggert 13 years ago
parent
commit
5bb0433507
9 changed files with 28 additions and 30 deletions
  1. 7 7
      src/buffer.c
  2. 1 1
      src/checkpoint.c
  3. 0 3
      src/compare.c
  4. 1 1
      src/list.c
  5. 4 4
      src/misc.c
  6. 1 1
      src/names.c
  7. 12 11
      src/tar.c
  8. 1 1
      src/unlink.c
  9. 1 1
      src/update.c

+ 7 - 7
src/buffer.c

@@ -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);
 }

+ 1 - 1
src/checkpoint.c

@@ -113,7 +113,7 @@ checkpoint_compile_action (const char *str)
 }
 
 void
-checkpoint_finish_compile ()
+checkpoint_finish_compile (void)
 {
   if (checkpoint_option)
     {

+ 0 - 3
src/compare.c

@@ -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)
     {

+ 1 - 1
src/list.c

@@ -1415,7 +1415,7 @@ skip_member (void)
 }
 
 void
-test_archive_label ()
+test_archive_label (void)
 {
   base64_init ();
   name_gather ();

+ 4 - 4
src/misc.c

@@ -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;
 	}

+ 1 - 1
src/names.c

@@ -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;

+ 12 - 11
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);
 }
 
 
@@ -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;

+ 1 - 1
src/unlink.c

@@ -123,7 +123,7 @@ flush_deferred_unlinks (bool force)
 }
 
 void
-finish_deferred_unlinks ()
+finish_deferred_unlinks (void)
 {
   flush_deferred_unlinks (true);
   while (dunlink_avail)

+ 1 - 1
src/update.c

@@ -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)