From 8ebbef8a15967965402fc0f79371410b755f4fee Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 19 Dec 2012 12:33:43 -0800 Subject: [PATCH] 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. --- src/buffer.c | 8 ++++---- src/common.h | 9 +-------- src/list.c | 2 +- src/tar.c | 6 ++++++ src/transform.c | 2 +- src/unlink.c | 2 +- src/xattrs.c | 6 +++--- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 422798e..4980d9b 100644 --- a/src/buffer.c +++ b/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) diff --git a/src/common.h b/src/common.h index eba3bb4..18f7bc6 100644 --- a/src/common.h +++ b/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. */ diff --git a/src/list.c b/src/list.c index 7bb719f..ffe255e 100644 --- a/src/list.c +++ b/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)) diff --git a/src/tar.c b/src/tar.c index cbb6c68..d230e95 100644 --- a/src/tar.c +++ b/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. */ diff --git a/src/transform.c b/src/transform.c index e9b776a..e268312 100644 --- a/src/transform.c +++ b/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 * diff --git a/src/unlink.c b/src/unlink.c index 522ae11..d89f3ed 100644 --- a/src/unlink.c +++ b/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) diff --git a/src/xattrs.c b/src/xattrs.c index 2ddd1af..ef436c7 100644 --- a/src/xattrs.c +++ b/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 -- 2.44.0