mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
Minor efficiency tweak.
(PATH_BASENAME_CONCAT): Use memcpy rather than strcpy. (do_link): Likewise.
This commit is contained in:
1 parent
156549eb5d
commit
401673f8dd
1 file changed
+7
-4
@@ -73,9 +73,10 @@ int symlink ();
|
||||
{ \
|
||||
const char *source_base; \
|
||||
char *tmp_source; \
|
||||
size_t buf_len = strlen (source) + 1; \
|
||||
\
|
||||
tmp_source = (char *) alloca (strlen ((source)) + 1); \
|
||||
strcpy (tmp_source, (source)); \
|
||||
tmp_source = (char *) alloca (buf_len); \
|
||||
memcpy (tmp_source, (source), buf_len); \
|
||||
strip_trailing_slashes (tmp_source); \
|
||||
source_base = base_name (tmp_source); \
|
||||
\
|
||||
@@ -260,11 +261,13 @@ do_link (const char *source, const char *dest)
|
||||
|
||||
if (backup_type != none)
|
||||
{
|
||||
size_t buf_len;
|
||||
char *tmp_backup = find_backup_file_name (dest, backup_type);
|
||||
if (tmp_backup == NULL)
|
||||
xalloc_die ();
|
||||
dest_backup = (char *) alloca (strlen (tmp_backup) + 1);
|
||||
strcpy (dest_backup, tmp_backup);
|
||||
buf_len = strlen (tmp_backup) + 1;
|
||||
dest_backup = (char *) alloca (buf_len);
|
||||
memcpy (dest_backup, tmp_backup, buf_len);
|
||||
free (tmp_backup);
|
||||
if (rename (dest, dest_backup))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user