1
1

(copy_dir_dir): get rid of extra string duplication.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2012-11-29 11:47:57 +04:00
родитель ba6b7ce976
Коммит 33dbb1338e

Просмотреть файл

@ -1933,7 +1933,7 @@ copy_file_file (FileOpTotalContext * tctx, FileOpContext * ctx,
function calls */ function calls */
FileProgressStatus FileProgressStatus
copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, const char *_d, copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, const char *d,
gboolean toplevel, gboolean move_over, gboolean do_delete, GSList * parent_dirs) gboolean toplevel, gboolean move_over, gboolean do_delete, GSList * parent_dirs)
{ {
struct dirent *next; struct dirent *next;
@ -1943,14 +1943,11 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
FileProgressStatus return_status = FILE_CONT; FileProgressStatus return_status = FILE_CONT;
struct utimbuf utb; struct utimbuf utb;
struct link *lp; struct link *lp;
char *d;
vfs_path_t *src_vpath, *dst_vpath, *dest_dir_vpath = NULL; vfs_path_t *src_vpath, *dst_vpath, *dest_dir_vpath = NULL;
gboolean do_mkdir = TRUE; gboolean do_mkdir = TRUE;
d = g_strdup (_d);
src_vpath = vfs_path_from_str (s); src_vpath = vfs_path_from_str (s);
dst_vpath = vfs_path_from_str (_d); dst_vpath = vfs_path_from_str (d);
/* First get the mode of the source dir */ /* First get the mode of the source dir */
@ -2031,8 +2028,7 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
goto ret; goto ret;
} }
} }
dest_dir = d; dest_dir = g_strdup (d);
d = NULL;
} }
else else
{ {
@ -2063,8 +2059,7 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
dest_dir = mc_build_filename (d, x_basename (s), NULL); dest_dir = mc_build_filename (d, x_basename (s), NULL);
else else
{ {
dest_dir = d; dest_dir = g_strdup (d);
d = NULL;
do_mkdir = FALSE; do_mkdir = FALSE;
} }
} }
@ -2199,7 +2194,6 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
free_link (parent_dirs->data); free_link (parent_dirs->data);
g_slist_free_1 (parent_dirs); g_slist_free_1 (parent_dirs);
ret_fast: ret_fast:
g_free (d);
vfs_path_free (src_vpath); vfs_path_free (src_vpath);
vfs_path_free (dst_vpath); vfs_path_free (dst_vpath);
return return_status; return return_status;