-- int32 l, i = targets[j].i;
-+ int32 l;
-
- if (sum != s->sums[i].sum1)
- continue;
-@@ -205,9 +190,11 @@ static void hash_search(int f,struct sum
- && !(s->sums[i].flags & SUMFLG_SAME_OFFSET))
- continue;
-
-- if (verbose > 3)
-- rprintf(FINFO,"potential match at %.0f target=%.0f %.0f sum=%08x\n",
-- (double)offset,(double)j,(double)i,sum);
-+ if (verbose > 3) {
-+ rprintf(FINFO,
-+ "potential match at %.0f i=%ld sum=%08x\n",
-+ (double)offset, (long)i, sum);
-+ }
-
- if (!done_csum2) {
- map = (schar *)map_ptr(buf,offset,l);
-@@ -224,8 +211,8 @@ static void hash_search(int f,struct sum
- * one with an identical offset, so we prefer that over
- * the following want_i optimization. */
- if (updating_basis_file) {
-- do {
-- int32 i2 = targets[j].i;
-+ int32 i2;
-+ for (i2 = i; i2 >= 0; i2 = s->sums[i2].chain) {
- if (s->sums[i2].offset != offset)
- continue;
- if (i2 != i) {
-@@ -240,7 +227,7 @@ static void hash_search(int f,struct sum
- * both the sender and the receiver. */
- s->sums[i].flags |= SUMFLG_SAME_OFFSET;
- goto set_want_i;
-- } while (++j < s->count && targets[j].t == t);
-+ }
- }
-
- /* we've found a match, but now check to see
-@@ -266,9 +253,9 @@ static void hash_search(int f,struct sum
- s2 = sum >> 16;
- matches++;
- break;
-- } while (++j < s->count && targets[j].t == t);
-+ } while ((i = s->sums[i].chain) >= 0);
-
-- null_tag:
-+ null_hash:
- backup = offset - last_match;
- /* We sometimes read 1 byte prior to last_match... */
- if (backup < 0)
-@@ -287,6 +274,7 @@ static void hash_search(int f,struct sum
- s2 += s1;
- } else
- --k;
-+ sum = (s1 & 0xffff) | (s2 << 16);
-
- /* By matching early we avoid re-reading the
- data 3 times in the case where a token
-@@ -323,7 +311,7 @@ void match_sums(int f, struct sum_struct
-
- last_match = 0;
- false_alarms = 0;
-- tag_hits = 0;
-+ hash_hits = 0;
- matches = 0;
- data_transfer = 0;
-
-@@ -375,16 +363,11 @@ void match_sums(int f, struct sum_struct
- rprintf(FINFO,"sending file_sum\n");
- write_buf(f,file_sum,MD4_SUM_LENGTH);
-
-- if (targets) {
-- free(targets);
-- targets=NULL;
-- }
--
- if (verbose > 2)
-- rprintf(FINFO, "false_alarms=%d tag_hits=%d matches=%d\n",
-- false_alarms, tag_hits, matches);
-+ rprintf(FINFO, "false_alarms=%d hash_hits=%d matches=%d\n",
-+ false_alarms, hash_hits, matches);