summaryrefslogtreecommitdiff
path: root/src/cp.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-03-26 12:05:51 +0000
committerJim Meyering <jim@meyering.net>2006-03-26 12:05:51 +0000
commitc3965052fe2d222744f58e7bbd2756a9548c8740 (patch)
treee90c6291d35f5d685cf49a51c74e593e28479813 /src/cp.c
parenta9e9c226dae2afb2d4c0bbbcc68918d00a915aff (diff)
downloadcoreutils-c3965052fe2d222744f58e7bbd2756a9548c8740.tar.xz
(target_directory_operand): Use new last_component.
(ASSIGN_BASENAME_STRDUPA): Likewise. Reduce time spent traversing the string.
Diffstat (limited to 'src/cp.c')
-rw-r--r--src/cp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cp.c b/src/cp.c
index dc31564f0..e2af41c29 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -42,8 +42,8 @@
{ \
char *tmp_abns_; \
ASSIGN_STRDUPA (tmp_abns_, (File_name)); \
- strip_trailing_slashes (tmp_abns_); \
- Dest = base_name (tmp_abns_); \
+ Dest = last_component (tmp_abns_); \
+ strip_trailing_slashes (Dest); \
} \
while (0)
@@ -519,7 +519,7 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
static bool
target_directory_operand (char const *file, struct stat *st, bool *new_dst)
{
- char const *b = base_name (file);
+ char const *b = last_component (file);
size_t blen = strlen (b);
bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
int err = (stat (file, st) == 0 ? 0 : errno);