Updated to use match.c's new "want_i" variable.
authorWayne Davison <wayned@samba.org>
Wed, 7 Jul 2004 08:41:55 +0000 (08:41 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 7 Jul 2004 08:41:55 +0000 (08:41 +0000)
inplace.diff

index 6565eae..dd95430 100644 (file)
@@ -23,7 +23,7 @@ Optional:
      memmove lchown vsnprintf snprintf asprintf setsid glob strpbrk \
      strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid)
  
---- orig/match.c       2004-07-04 08:08:30
+--- orig/match.c       2004-07-07 08:38:52
 +++ match.c    2004-07-04 08:03:36
 @@ -23,6 +23,7 @@ extern int verbose;
  extern int am_server;
@@ -52,7 +52,7 @@ Optional:
  
 +                      /* If inplace is enabled, the best possible match is
 +                       * one with an identical offset, so we prefer that over
-+                       * the following last_i+1 optimization. */
++                       * the following want_i optimization. */
 +                      if (inplace) {
 +                              do {
 +                                      size_t i2 = targets[j].i;
@@ -70,22 +70,22 @@ Optional:
 +                                       * this chunk was at the same offset on
 +                                       * both the sender and the receiver. */
 +                                      s->sums[i].i = -1;
-+                                      goto set_last_i;
++                                      goto set_want_i;
 +                              } while (++j < s->count && targets[j].t == t);
 +                      }
 +
                        /* we've found a match, but now check to see
-                        * if last_i can hint at a better match */
-                       if (i != last_i + 1 && last_i + 1 < s->count
-+                          && (!inplace || s->sums[last_i+1].offset >= offset || s->sums[last_i+1].i < 0)
-                           && sum == s->sums[last_i+1].sum1
-                           && memcmp(sum2, s->sums[last_i+1].sum2, s->s2length) == 0) {
+                        * 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)
+                           && 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
                                 * will be happy */
-                               i = last_i + 1;
+                               i = want_i;
                        }
-+                  set_last_i:
-                       last_i = i;
++                  set_want_i:
+                       want_i = i + 1;
  
                        matched(f,s,buf,offset,i);
 --- orig/options.c     2004-06-20 19:30:00