Fix problems caught by static checking
Most of these can be caught by configuring with --enable-gcc-warnings. Problem reported by Pavel Raiskup in: http://lists.gnu.org/archive/html/bug-tar/2015-09/msg00001.html * src/buffer.c (format_total_stats): Prefer pointer to const when it’s OK to use const. (default_total_format): Now const. * src/buffer.c (default_total_format): * src/exclist.c (excfile_head, excfile_tail, vcs_ignore_files): * src/misc.c (namebuf_add_dir, namebuf_finish): * src/tar.c (verbatim_files_from_option, option_set_in_cl) (optloc_eq, set_old_files_option): Now static. * src/common.h: Adjust to match the other changes described here. * src/exclist.c (info_cleanup_exclist): * src/tar.c (argp_program_version, argp_program_bug_address): Remove; unused. (parse_default_options): Define via prototype instead of old style. (parse_default_options, decode_options): Fill out incomplete initializers.
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
|
||||
#endif
|
||||
|
||||
static void namebuf_add_dir (namebuf_t, char const *);
|
||||
static char *namebuf_finish (namebuf_t);
|
||||
static const char *tar_getcdpath (int);
|
||||
|
||||
|
||||
@@ -1202,7 +1204,7 @@ namebuf_name (namebuf_t buf, const char *name)
|
||||
return buf->buffer;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
namebuf_add_dir (namebuf_t buf, const char *name)
|
||||
{
|
||||
static char dirsep[] = { DIRECTORY_SEPARATOR, 0 };
|
||||
@@ -1215,7 +1217,7 @@ namebuf_add_dir (namebuf_t buf, const char *name)
|
||||
buf->dir_length += strlen (name);
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
namebuf_finish (namebuf_t buf)
|
||||
{
|
||||
char *res = buf->buffer;
|
||||
|
||||
Reference in New Issue
Block a user