From 4d89650c8c488406bbc10fffb2f6291155eaa4fd Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 27 Feb 2006 03:28:04 +0000 Subject: [PATCH] Improved a few minor things. --- dynamic_hash.diff | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/dynamic_hash.diff b/dynamic_hash.diff index 5f32e20..3713823 100644 --- a/dynamic_hash.diff +++ b/dynamic_hash.diff @@ -68,7 +68,7 @@ An extended version of a patch by Shachar Shemesh. - targets = new_array(struct target, s->count); - if (!tag_table || !targets) - out_of_memory("build_hash_table"); -+ memset(sum_table, 0xFF, tablesize * sizeof (sum_table[0])); ++ memset(sum_table, 0xFF, tablesize * sizeof sum_table[0]); for (i = 0; i < s->count; i++) { - targets[i].i = i; @@ -113,7 +113,7 @@ An extended version of a patch by Shachar Shemesh. if (sum != s->sums[i].sum1) continue; -@@ -205,9 +187,10 @@ static void hash_search(int f,struct sum +@@ -205,9 +187,11 @@ static void hash_search(int f,struct sum && !(s->sums[i].flags & SUMFLG_SAME_OFFSET)) continue; @@ -121,13 +121,14 @@ An extended version of a patch by Shachar Shemesh. - 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", ++ 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,23 +207,23 @@ static void hash_search(int f,struct sum +@@ -224,8 +208,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) { @@ -138,16 +139,7 @@ An extended version of a patch by Shachar Shemesh. if (s->sums[i2].offset != offset) continue; if (i2 != i) { - if (sum != s->sums[i2].sum1) -- break; -+ continue; - if (memcmp(sum2, s->sums[i2].sum2, - s->s2length) != 0) -- break; -+ continue; - i = i2; - } - /* This chunk was at the same offset on +@@ -240,7 +224,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; @@ -156,7 +148,7 @@ An extended version of a patch by Shachar Shemesh. } /* we've found a match, but now check to see -@@ -266,9 +249,8 @@ static void hash_search(int f,struct sum +@@ -266,9 +250,8 @@ static void hash_search(int f,struct sum s2 = sum >> 16; matches++; break; @@ -167,7 +159,7 @@ An extended version of a patch by Shachar Shemesh. backup = offset - last_match; /* We sometimes read 1 byte prior to last_match... */ if (backup < 0) -@@ -375,11 +357,6 @@ void match_sums(int f, struct sum_struct +@@ -375,11 +358,6 @@ void match_sums(int f, struct sum_struct rprintf(FINFO,"sending file_sum\n"); write_buf(f,file_sum,MD4_SUM_LENGTH); -- 2.34.1