Commit a36ffd39 authored by Wayne Davison's avatar Wayne Davison

Changed the checks for --inplace to use the new updating_basis_file

variable.
parent 17b5b32f
...@@ -23,8 +23,8 @@ extern int verbose; ...@@ -23,8 +23,8 @@ extern int verbose;
extern int am_server; extern int am_server;
extern int do_progress; extern int do_progress;
extern int checksum_seed; extern int checksum_seed;
extern int inplace;
extern int make_backups; int updating_basis_file;
typedef unsigned short tag; typedef unsigned short tag;
...@@ -206,9 +206,9 @@ static void hash_search(int f,struct sum_struct *s, ...@@ -206,9 +206,9 @@ static void hash_search(int f,struct sum_struct *s,
if (l != s->sums[i].len) if (l != s->sums[i].len)
continue; continue;
/* inplace: ensure chunk's offset is either >= our /* in-place: ensure chunk's offset is either >= our
* offset or that the data didn't move. */ * offset or that the data didn't move. */
if (inplace && !make_backups && s->sums[i].offset < offset if (updating_basis_file && s->sums[i].offset < offset
&& !(s->sums[i].flags & SUMFLG_SAME_OFFSET)) && !(s->sums[i].flags & SUMFLG_SAME_OFFSET))
continue; continue;
...@@ -227,10 +227,10 @@ static void hash_search(int f,struct sum_struct *s, ...@@ -227,10 +227,10 @@ static void hash_search(int f,struct sum_struct *s,
continue; continue;
} }
/* If inplace is enabled, the best possible match is /* When updating in-place, the best possible match is
* one with an identical offset, so we prefer that over * one with an identical offset, so we prefer that over
* the following want_i optimization. */ * the following want_i optimization. */
if (inplace && !make_backups) { if (updating_basis_file) {
do { do {
size_t i2 = targets[j].i; size_t i2 = targets[j].i;
if (s->sums[i2].offset != offset) if (s->sums[i2].offset != offset)
...@@ -253,7 +253,7 @@ static void hash_search(int f,struct sum_struct *s, ...@@ -253,7 +253,7 @@ static void hash_search(int f,struct sum_struct *s,
/* we've found a match, but now check to see /* we've found a match, but now check to see
* if want_i can hint at a better match. */ * if want_i can hint at a better match. */
if (i != want_i && want_i < s->count if (i != want_i && want_i < s->count
&& (!inplace || make_backups || s->sums[want_i].offset >= offset && (!updating_basis_file || s->sums[want_i].offset >= offset
|| s->sums[want_i].flags & SUMFLG_SAME_OFFSET) || s->sums[want_i].flags & SUMFLG_SAME_OFFSET)
&& sum == s->sums[want_i].sum1 && sum == s->sums[want_i].sum1
&& memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) { && memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment