diff options
author | Jim Meyering <jim@meyering.net> | 2007-09-24 15:09:17 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-09-24 15:09:26 +0200 |
commit | 49e002db5e8282d060190e3c1ea27a796349c4b1 (patch) | |
tree | 60d31080f693d672005b5cd6358c98cf6f98342e | |
parent | 1b246cc692a34fc5caee2ec6e154fb3a53665f56 (diff) | |
download | coreutils-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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/copy.c | 66 |
2 files changed, 8 insertions, 65 deletions
@@ -1,3 +1,10 @@ +2007-09-24 Jim Meyering <jim@meyering.net> + + 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. + 2007-09-22 Jim Meyering <jim@meyering.net> Don't print the commands of a 10-line script that's run in each subdir. 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. |