[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] cp: remove ASSIGN_BASENAME_STRDUPA
From: |
Paul Eggert |
Subject: |
[PATCH] cp: remove ASSIGN_BASENAME_STRDUPA |
Date: |
Fri, 5 Jan 2018 22:57:52 -0800 |
* src/cp.c (do_copy): Just use ASSIGN_STRDUPA, as this simplifies
the code and uses less memory.
---
src/cp.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/cp.c b/src/cp.c
index d81d41859..04ceb8687 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -40,16 +40,6 @@
# define lchown(name, uid, gid) chown (name, uid, gid)
#endif
-#define ASSIGN_BASENAME_STRDUPA(Dest, File_name) \
- do \
- { \
- char *tmp_abns_; \
- ASSIGN_STRDUPA (tmp_abns_, (File_name)); \
- Dest = last_component (tmp_abns_); \
- strip_trailing_slashes (Dest); \
- } \
- while (0)
-
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "cp"
@@ -693,8 +683,8 @@ do_copy (int n_files, char **file, const char
*target_directory,
{
char *arg_base;
/* Append the last component of 'arg' to 'target_directory'. */
-
- ASSIGN_BASENAME_STRDUPA (arg_base, arg);
+ ASSIGN_STRDUPA (arg_base, last_component (arg));
+ strip_trailing_slashes (arg_base);
/* For 'cp -R source/.. dest', don't copy into 'dest/..'. */
dst_name = (STREQ (arg_base, "..")
? xstrdup (target_directory)
--
2.14.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] cp: remove ASSIGN_BASENAME_STRDUPA,
Paul Eggert <=