Optimized the calling of access() in one loop.
authorWayne Davison <wayned@samba.org>
Wed, 23 Jun 2004 17:32:40 +0000 (17:32 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 23 Jun 2004 17:32:40 +0000 (17:32 +0000)
compare-dest.diff

index 5a76655..1b2b4d3 100644 (file)
@@ -4,8 +4,8 @@ algorithm does NOT search for the best match -- it stops at the first
 match and uses that as the basis file for the transfer, so be sure to
 order your arguments appropriately.
 
---- generator.c        18 Jun 2004 16:30:24 -0000      1.88
-+++ generator.c        23 Jun 2004 17:08:19 -0000
+--- generator.c        23 Jun 2004 16:51:21 -0000      1.89
++++ generator.c        23 Jun 2004 17:29:39 -0000
 @@ -42,7 +42,7 @@ extern int size_only;
  extern int io_timeout;
  extern int protocol_version;
@@ -15,7 +15,7 @@ order your arguments appropriately.
  extern int link_dest;
  extern int whole_file;
  extern int local_server;
-@@ -81,13 +81,12 @@ static int skip_file(char *fname, struct
+@@ -80,13 +80,12 @@ static int skip_file(char *fname, struct
        if (always_checksum && S_ISREG(st->st_mode)) {
                char sum[MD4_SUM_LENGTH];
                char fnamecmpdest[MAXPATHLEN];
@@ -27,14 +27,14 @@ order your arguments appropriately.
 -                                       compare_dest, fname);
 -                              fname = fnamecmpdest;
 -                      }
-+              for (i = 0; access(fname, 0) != 0 && compare_dest[i] != NULL; i++) {
++              for (i = 0; compare_dest[i] != NULL && access(fname, 0) < 0; i++) {
 +                      pathjoin(fnamecmpdest, sizeof fnamecmpdest,
 +                                      compare_dest[i], fname);
 +                      fname = fnamecmpdest;
                }
                file_checksum(fname,sum,st->st_size);
                return memcmp(sum, file->u.sum, protocol_version < 21 ? 2
-@@ -426,13 +425,18 @@ void recv_generator(char *fname, struct 
+@@ -423,13 +422,18 @@ void recv_generator(char *fname, struct 
  
        fnamecmp = fname;
  
@@ -59,7 +59,7 @@ order your arguments appropriately.
                        errno = saveerrno;
  #if HAVE_LINK
 --- options.c  20 Jun 2004 19:47:05 -0000      1.157
-+++ options.c  23 Jun 2004 17:08:19 -0000
++++ options.c  23 Jun 2004 17:29:39 -0000
 @@ -117,7 +117,8 @@ unsigned int backup_dir_remainder;
  
  char *backup_suffix = NULL;
@@ -187,7 +187,7 @@ order your arguments appropriately.
  
        if (files_from && (!am_sender || remote_filesfrom_file)) {
 --- receiver.c 14 Jun 2004 15:09:36 -0000      1.82
-+++ receiver.c 23 Jun 2004 17:08:19 -0000
++++ receiver.c 23 Jun 2004 17:29:39 -0000
 @@ -36,7 +36,7 @@ extern int preserve_perms;
  extern int cvs_exclude;
  extern int io_error;
@@ -220,7 +220,7 @@ order your arguments appropriately.
                        fd1 = do_open(fnamecmp, O_RDONLY, 0);
                }
 --- rsync.h    16 May 2004 07:28:24 -0000      1.204
-+++ rsync.h    23 Jun 2004 17:08:20 -0000
++++ rsync.h    23 Jun 2004 17:29:40 -0000
 @@ -98,6 +98,8 @@
  
  #define MAX_ARGS 1000