changeset 952:77a1d5a0326d

Optimize redundant tests.
author zas_
date Mon, 28 Jul 2008 17:56:56 +0000
parents 6ce7133c730d
children 1e61dac76311
files src/filedata.c
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Mon Jul 28 17:55:06 2008 +0000
+++ b/src/filedata.c	Mon Jul 28 17:56:56 2008 +0000
@@ -1624,15 +1624,18 @@
 			ret |= CHANGE_NO_WRITE_PERM_DEST_DIR;
 			DEBUG_1("Change checked: destination dir is readonly: %s -> %s", fd->path, fd->change->dest);
 			}
-		else if (isfile(fd->change->dest) && !access_file(fd->change->dest, W_OK) && (strcmp(fd->change->dest, fd->path) != 0))
-			{
-			ret |= CHANGE_NO_WRITE_PERM_DEST;
-			DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest);
-			}
 		else if (isfile(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0))
 			{
-			ret |= CHANGE_WARN_DEST_EXISTS;
-			DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);
+			if (!access_file(fd->change->dest, W_OK))
+				{
+				ret |= CHANGE_NO_WRITE_PERM_DEST;
+				DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest);
+				}
+			else
+				{
+				ret |= CHANGE_WARN_DEST_EXISTS;
+				DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);
+				}
 			}
 		else if (isdir(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0))
 			{