changeset 951:6ce7133c730d

Move dest_dir variable to inner block.
author zas_
date Mon, 28 Jul 2008 17:55:06 +0000
parents c32b6393b21d
children 77a1d5a0326d
files src/filedata.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Mon Jul 28 09:44:50 2008 +0000
+++ b/src/filedata.c	Mon Jul 28 17:55:06 2008 +0000
@@ -1556,7 +1556,6 @@
 {
 	gint ret = CHANGE_OK;
 	gchar *dir;
-	gchar *dest_dir = NULL;
 	
 	if (!fd->change)
 		{
@@ -1574,8 +1573,6 @@
 		
 	dir = remove_level_from_path(fd->path);
 	
-	if (fd->change->dest) dest_dir = remove_level_from_path(fd->change->dest);
-
 	if (fd->change->type != FILEDATA_CHANGE_DELETE && 
 	    !access_file(fd->path, R_OK))
 		{
@@ -1598,6 +1595,7 @@
 
 	if (fd->change->dest)
 		{
+		gchar *dest_dir;
 		const gchar *dest_ext = extension_from_path(fd->change->dest);
 		if (!dest_ext) dest_ext = "";
 		
@@ -1614,6 +1612,8 @@
 			DEBUG_1("Change checked: source and destination are the same: %s -> %s", fd->path, fd->change->dest);
 		}
 
+		dest_dir = remove_level_from_path(fd->change->dest);
+
 		if (!isdir(dest_dir))		
 			{
 			ret |= CHANGE_NO_DEST_DIR;
@@ -1639,13 +1639,14 @@
 			ret |= CHANGE_DEST_EXISTS;
 			DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);
 			}
+
+		g_free(dest_dir);
 		}
 		
 	fd->change->error = ret;
 	if (ret == 0) DEBUG_1("Change checked: OK: %s", fd->path);
 
 	g_free(dir);
-	g_free(dest_dir);
 	return ret;
 }