mirror of
https://github.com/coreutils/coreutils.git
synced 2026-10-28 09:44:34 +08:00
cp: simplify cp/install/ln/mv pacification
* src/copy.c (dest_info_free, src_info_free) [lint]: Remove. All uses removed. (copy_internal): Pacify only Clang and Coverity; GCC doesn’t need it. * src/cp-hash.c (forget_all) [lint]: Remove. All uses removed. * src/cp.c, src/install.c, src/ln.c, src/mv.c (main): Use main_exit, not return.
This commit is contained in:
1 parent
b50b63e06c
commit
f21ccfb02c
7 files changed
+6
-60
No files matched your search
+2
-22
@@ -1759,16 +1759,6 @@ dest_info_init (struct cp_options *x)
|
||||
xalloc_die ();
|
||||
}
|
||||
|
||||
#ifdef lint
|
||||
extern void
|
||||
dest_info_free (struct cp_options *x)
|
||||
{
|
||||
if (x->dest_info)
|
||||
hash_free (x->dest_info);
|
||||
x->dest_info = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the hash table implementing a set of F_triple entries
|
||||
corresponding to source files listed on the command line. */
|
||||
extern void
|
||||
@@ -1793,16 +1783,6 @@ src_info_init (struct cp_options *x)
|
||||
xalloc_die ();
|
||||
}
|
||||
|
||||
#ifdef lint
|
||||
extern void
|
||||
src_info_free (struct cp_options *x)
|
||||
{
|
||||
if (x->src_info)
|
||||
hash_free (x->src_info);
|
||||
x->src_info = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* When effecting a move (e.g., for mv(1)), and given the name DST_NAME
|
||||
aka DST_DIRFD+DST_RELNAME
|
||||
of the destination and a corresponding stat buffer, DST_SB, return
|
||||
@@ -2014,13 +1994,13 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#ifdef lint
|
||||
else
|
||||
{
|
||||
#if defined lint && (defined __clang__ || defined __COVERITY__)
|
||||
assert (x->move_mode);
|
||||
memset (&src_sb, 0, sizeof src_sb);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Detect the case in which the same source file appears more than
|
||||
once on the command line and no backup option has been selected.
|
||||
|
||||
@@ -153,14 +153,3 @@ hash_init (void)
|
||||
if (src_to_dest == NULL)
|
||||
xalloc_die ();
|
||||
}
|
||||
|
||||
/* Reset the hash structure in the global variable 'htab' to
|
||||
contain no entries. */
|
||||
|
||||
#ifdef lint
|
||||
extern void
|
||||
forget_all (void)
|
||||
{
|
||||
hash_free (src_to_dest);
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,4 @@
|
||||
void hash_init (void);
|
||||
void forget_all (void);
|
||||
void forget_created (ino_t ino, dev_t dev);
|
||||
char *remember_copied (char const *node, ino_t ino, dev_t dev)
|
||||
_GL_ATTRIBUTE_NONNULL ();
|
||||
|
||||
@@ -735,11 +735,6 @@ do_copy (int n_files, char **file, char const *target_directory,
|
||||
|
||||
free (dst_name);
|
||||
}
|
||||
|
||||
#ifdef lint
|
||||
dest_info_free (x);
|
||||
src_info_free (x);
|
||||
#endif
|
||||
}
|
||||
else /* !target_directory */
|
||||
{
|
||||
@@ -1218,9 +1213,5 @@ main (int argc, char **argv)
|
||||
ok = do_copy (argc - optind, argv + optind,
|
||||
target_directory, no_target_directory, &x);
|
||||
|
||||
#ifdef lint
|
||||
forget_all ();
|
||||
#endif
|
||||
|
||||
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
main_exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
+1
-4
@@ -1023,11 +1023,8 @@ main (int argc, char **argv)
|
||||
i == 0 && mkdir_and_install,
|
||||
&target_dirfd))
|
||||
exit_status = EXIT_FAILURE;
|
||||
#ifdef lint
|
||||
dest_info_free (&x);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return exit_status;
|
||||
main_exit (exit_status);
|
||||
}
|
||||
@@ -674,15 +674,9 @@ main (int argc, char **argv)
|
||||
ok &= do_link (file[i], destdir_fd, dest_base, dest, -1);
|
||||
free (dest);
|
||||
}
|
||||
|
||||
#ifdef lint
|
||||
if (dest_set)
|
||||
hash_free (dest_set);
|
||||
dest_set = NULL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
ok = do_link (file[0], AT_FDCWD, file[1], file[1], link_errno);
|
||||
|
||||
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
main_exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
@@ -487,10 +487,6 @@ main (int argc, char **argv)
|
||||
ok &= do_move (source, dest, target_dirfd, dest_relname, &x);
|
||||
free (dest);
|
||||
}
|
||||
|
||||
#ifdef lint
|
||||
dest_info_free (&x);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -498,5 +494,5 @@ main (int argc, char **argv)
|
||||
ok = do_move (file[0], file[1], AT_FDCWD, file[1], &x);
|
||||
}
|
||||
|
||||
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
main_exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
Reference in new issue
Block a user