Got rid of the unused "i" value in struct sum_buf and replaced it
authorWayne Davison <wayned@samba.org>
Fri, 16 Jul 2004 19:55:55 +0000 (19:55 +0000)
committerWayne Davison <wayned@samba.org>
Fri, 16 Jul 2004 19:55:55 +0000 (19:55 +0000)
will a "flags" value.

inplace.diff

index 8c337f8..7200d2b 100644 (file)
@@ -24,7 +24,7 @@ Optional:
      strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid)
  
 --- orig/match.c       2004-07-15 02:21:10
-+++ match.c    2004-07-04 08:03:36
++++ match.c    2004-07-16 19:39:08
 @@ -23,6 +23,7 @@ extern int verbose;
  extern int am_server;
  extern int do_progress;
@@ -40,7 +40,7 @@ Optional:
 +                      /* inplace: ensure chunk's offset is either >= our
 +                       * offset or that the data didn't move. */
 +                      if (inplace && s->sums[i].offset < offset
-+                          && s->sums[i].i >= 0)
++                          && !(s->sums[i].flags & SUMFLG_SAME_OFFSET))
 +                              continue;
 +
                        if (verbose > 3)
@@ -66,10 +66,9 @@ Optional:
 +                                                      break;
 +                                              i = i2;
 +                                      }
-+                                      /* Use this as a flag to indicate that
-+                                       * this chunk was at the same offset on
++                                      /* This chunk was at the same offset on
 +                                       * both the sender and the receiver. */
-+                                      s->sums[i].i = -1;
++                                      s->sums[i].flags |= SUMFLG_SAME_OFFSET;
 +                                      goto set_want_i;
 +                              } while (++j < s->count && targets[j].t == t);
 +                      }
@@ -77,7 +76,8 @@ Optional:
                        /* we've found a match, but now check to see
                         * if want_i can hint at a better match. */
                        if (i != want_i && want_i < s->count
-+                          && (!inplace || s->sums[want_i].offset >= offset || s->sums[want_i].i < 0)
++                          && (!inplace || s->sums[want_i].offset >= offset
++                           || s->sums[want_i].flags & SUMFLG_SAME_OFFSET)
                            && sum == s->sums[want_i].sum1
                            && memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) {
                                /* we've found an adjacent match - the RLL coder
@@ -88,7 +88,7 @@ Optional:
                        want_i = i + 1;
  
                        matched(f,s,buf,offset,i);
---- orig/options.c     2004-07-15 16:51:50
+--- orig/options.c     2004-07-16 19:35:29
 +++ options.c  2004-07-03 20:19:54
 @@ -94,6 +94,7 @@ int ignore_errors = 0;
  int modify_window = 0;
@@ -144,7 +144,7 @@ Optional:
    {"keep-dirlinks",   'K', POPT_ARG_NONE,   &keep_dirlinks, 0, 0, 0 },
    {"links",           'l', POPT_ARG_NONE,   &preserve_links, 0, 0, 0 },
    {"copy-links",      'L', POPT_ARG_NONE,   &copy_links, 0, 0, 0 },
-@@ -738,6 +746,18 @@ int parse_arguments(int *argc, const cha
+@@ -754,6 +762,18 @@ int parse_arguments(int *argc, const cha
                        bwlimit_writemax = 512;
        }
  
@@ -163,7 +163,7 @@ Optional:
        if (files_from) {
                char *colon;
                if (*argc != 2 && !(am_server && am_sender && *argc == 1)) {
-@@ -955,6 +975,9 @@ void server_options(char **args,int *arg
+@@ -971,6 +991,9 @@ void server_options(char **args,int *arg
        if (opt_ignore_existing && am_sender)
                args[ac++] = "--ignore-existing";
  
@@ -336,7 +336,24 @@ Optional:
        /* move tmp file over real file */
        if (verbose > 2)
                rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
---- orig/rsync.yo      2004-07-15 02:21:11
+--- orig/rsync.h       2004-07-07 08:27:00
++++ rsync.h    2004-07-16 19:36:20
+@@ -458,11 +458,13 @@ struct file_list {
+       struct file_struct **files;
+ };
++#define SUMFLG_SAME_OFFSET    (1<<0)
++
+ struct sum_buf {
+       OFF_T offset;           /**< offset in file of this chunk */
+       unsigned int len;       /**< length of chunk of file */
+-      int i;                  /**< index of this chunk */
+       uint32 sum1;            /**< simple checksum */
++      short flags;            /**< flag bits */
+       char sum2[SUM_LENGTH];  /**< checksum  */
+ };
+--- orig/rsync.yo      2004-07-16 19:35:29
 +++ rsync.yo   2004-07-03 20:19:55
 @@ -289,6 +289,7 @@ verb(
       --backup-dir            make backups into this directory
@@ -364,3 +381,14 @@ Optional:
  dit(bf(-l, --links)) When symlinks are encountered, recreate the
  symlink on the destination.
  
+--- orig/sender.c      2004-07-15 02:21:11
++++ sender.c   2004-07-16 19:40:59
+@@ -85,7 +85,7 @@ static struct sum_struct *receive_sums(i
+               read_buf(f, s->sums[i].sum2, s->s2length);
+               s->sums[i].offset = offset;
+-              s->sums[i].i = i;
++              s->sums[i].flags = 0;
+               if (i == (int) s->count-1 && s->remainder != 0) {
+                       s->sums[i].len = s->remainder;