Jelajahi Sumber

tar: remove unused externs, or make them static

* src/buffer.c (record_buffer_aligned, flush_write_ptr, flush_read_ptr)
(duration):
* src/list.c (recent_global_header):
* src/unlink.c (deferred_unlink_delay):
* src/transform.c (transform_flags):
* src/xattrs.c (acl_get_file_at, acl_set_file_at, file_has_acl_at):
Now static.
* src/common.h (rmt_command_option): Remove; unused.
* src/tar.c (check_links_option, allocated_archive_names):
Move decls here from common.h; these are now static.
Paul Eggert 12 tahun lalu
induk
melakukan
8ebbef8a15
7 mengubah file dengan 17 tambahan dan 18 penghapusan
  1. 4 4
      src/buffer.c
  2. 1 8
      src/common.h
  3. 1 1
      src/list.c
  4. 6 0
      src/tar.c
  5. 1 1
      src/transform.c
  6. 1 1
      src/unlink.c
  7. 3 3
      src/xattrs.c

+ 4 - 4
src/buffer.c

@@ -41,7 +41,7 @@
 static tarlong prev_written;    /* bytes written on previous volumes */
 static tarlong bytes_written;   /* bytes written on this volume */
 static void *record_buffer[2];  /* allocated memory */
-union block *record_buffer_aligned[2];
+static union block *record_buffer_aligned[2];
 static int record_index;
 
 /* FIXME: The following variables should ideally be static to this
@@ -83,8 +83,8 @@ extern bool time_to_start_writing;
 
 bool write_archive_to_stdout;
 
-void (*flush_write_ptr) (size_t);
-void (*flush_read_ptr) (void);
+static void (*flush_write_ptr) (size_t);
+static void (*flush_read_ptr) (void);
 
 
 char *volume_label;
@@ -230,7 +230,7 @@ clear_read_error_count (void)
 
 /* Time-related functions */
 
-double duration;
+static double duration;
 
 void
 set_start_time (void)

+ 1 - 8
src/common.h

@@ -143,9 +143,6 @@ GLOBAL const char *use_compress_program_option;
 GLOBAL bool dereference_option;
 GLOBAL bool hard_dereference_option;
 
-/* Print a message if not all links are dumped */
-GLOBAL int check_links_option;
-
 /* Patterns that match file names to be excluded.  */
 GLOBAL struct exclude *excluded;
 
@@ -247,9 +244,6 @@ GLOBAL bool read_full_records_option;
 
 GLOBAL bool remove_files_option;
 
-/* Specified rmt command.  */
-GLOBAL const char *rmt_command_option;
-
 /* Specified remote shell command.  */
 GLOBAL const char *rsh_command_option;
 
@@ -330,11 +324,10 @@ GLOBAL struct timespec last_stat_time;    /* when the statistics was last
 
 GLOBAL struct tar_stat_info current_stat_info;
 
-/* List of tape drive names, number of such tape drives, allocated number,
+/* List of tape drive names, number of such tape drives,
    and current cursor in list.  */
 GLOBAL const char **archive_name_array;
 GLOBAL size_t archive_names;
-GLOBAL size_t allocated_archive_names;
 GLOBAL const char **archive_name_cursor;
 
 /* Output index file name.  */

+ 1 - 1
src/list.c

@@ -34,7 +34,7 @@ union block *recent_long_name;	/* recent long name header and contents */
 union block *recent_long_link;	/* likewise, for long link */
 size_t recent_long_name_blocks;	/* number of blocks in recent_long_name */
 size_t recent_long_link_blocks;	/* likewise, for long link */
-union block *recent_global_header; /* Recent global header block */
+static union block *recent_global_header; /* Recent global header block */
 
 #define GID_FROM_HEADER(where) gid_from_header (where, sizeof (where))
 #define MAJOR_FROM_HEADER(where) major_from_header (where, sizeof (where))

+ 6 - 0
src/tar.c

@@ -68,6 +68,12 @@
 # define DEFAULT_BLOCKING 20
 #endif
 
+/* Print a message if not all links are dumped */
+static int check_links_option;
+
+/* Number of allocated tape drive names.  */
+static size_t allocated_archive_names;
+
 
 /* Miscellaneous.  */
 

+ 1 - 1
src/transform.c

@@ -71,7 +71,7 @@ struct transform
 
 
 
-int transform_flags = XFORM_ALL;
+static int transform_flags = XFORM_ALL;
 static struct transform *transform_head, *transform_tail;
 
 static struct transform *

+ 1 - 1
src/unlink.c

@@ -39,7 +39,7 @@ static struct deferred_unlink *dunlink_avail;
 
 /* Delay (number of records written) between adding entry to the
    list and its actual removal. */
-size_t deferred_unlink_delay = 0;
+static size_t deferred_unlink_delay = 0;
 
 static struct deferred_unlink *
 dunlink_alloc (void)

+ 3 - 3
src/xattrs.c

@@ -58,9 +58,9 @@ static struct
 #ifdef HAVE_POSIX_ACLS
 
 /* acl-at wrappers, TODO: move to gnulib in future? */
-acl_t acl_get_file_at (int dirfd, const char *file, acl_type_t type);
-int acl_set_file_at (int dirfd, const char *file, acl_type_t type, acl_t acl);
-int file_has_acl_at (int dirfd, char const *, struct stat const *);
+static acl_t acl_get_file_at (int, const char *, acl_type_t);
+static int acl_set_file_at (int, const char *, acl_type_t, acl_t);
+static int file_has_acl_at (int, char const *, struct stat const *);
 
 /* acl_get_file_at */
 #define AT_FUNC_NAME acl_get_file_at