summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-09-24 15:09:17 +0200
committerJim Meyering <jim@meyering.net>2007-09-24 15:09:26 +0200
commit49e002db5e8282d060190e3c1ea27a796349c4b1 (patch)
tree60d31080f693d672005b5cd6358c98cf6f98342e /src
parent1b246cc692a34fc5caee2ec6e154fb3a53665f56 (diff)
downloadcoreutils-49e002db5e8282d060190e3c1ea27a796349c4b1.tar.xz
copy.c: Remove definitions of factored-out functions.
* src/copy.c: Include "file-set.h". (seen_file, record_file): Remove functions that I factored out on 2007-08-23.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c66
1 files changed, 1 insertions, 65 deletions
diff --git a/src/copy.c b/src/copy.c
index 92588bf14..331fef871 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -39,6 +39,7 @@
#include "euidaccess.h"
#include "error.h"
#include "fcntl--.h"
+#include "file-set.h"
#include "filemode.h"
#include "filenamecat.h"
#include "full-write.h"
@@ -931,71 +932,6 @@ src_info_init (struct cp_options *x)
triple_free);
}
-/* Return true if there is an entry in hash table, HT,
- for the file described by FILE and STATS. */
-static bool
-seen_file (Hash_table const *ht, char const *file,
- struct stat const *stats)
-{
- struct F_triple new_ent;
-
- if (ht == NULL)
- return false;
-
- new_ent.name = (char *) file;
- new_ent.st_ino = stats->st_ino;
- new_ent.st_dev = stats->st_dev;
-
- return !!hash_lookup (ht, &new_ent);
-}
-
-/* Record destination file, FILE, and dev/ino from *STATS,
- in the hash table, HT. If HT is NULL, return immediately.
- If STATS is NULL, call lstat on FILE to get the device
- and inode numbers. If that lstat fails, simply return.
- If memory allocation fails, exit immediately. */
-static void
-record_file (Hash_table *ht, char const *file,
- struct stat const *stats)
-{
- struct F_triple *ent;
-
- if (ht == NULL)
- return;
-
- ent = xmalloc (sizeof *ent);
- ent->name = xstrdup (file);
- if (stats)
- {
- ent->st_ino = stats->st_ino;
- ent->st_dev = stats->st_dev;
- }
- else
- {
- struct stat sb;
- if (lstat (file, &sb) != 0)
- return;
- ent->st_ino = sb.st_ino;
- ent->st_dev = sb.st_dev;
- }
-
- {
- struct F_triple *ent_from_table = hash_insert (ht, ent);
- if (ent_from_table == NULL)
- {
- /* Insertion failed due to lack of memory. */
- xalloc_die ();
- }
-
- if (ent_from_table != ent)
- {
- /* There was alread a matching entry in the table, so ENT was
- not inserted. Free it. */
- triple_free (ent);
- }
- }
-}
-
/* When effecting a move (e.g., for mv(1)), and given the name DST_NAME
of the destination and a corresponding stat buffer, DST_SB, return
true if the logical `move' operation should _not_ proceed.