diff options
author | Wayne Davison <wayned@samba.org> | 2004-07-02 23:35:30 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2004-07-02 23:35:30 +0000 |
commit | 5e252dea4b2d310dbbb3a57337199836aff8f086 (patch) | |
tree | cb2817d06b38c1908dee9a242745a38a8ac51a43 /match.c | |
parent | d2a918b4544d476b777c2cc69494659328f50987 (diff) | |
download | android_external_rsync-5e252dea4b2d310dbbb3a57337199836aff8f086.tar.gz android_external_rsync-5e252dea4b2d310dbbb3a57337199836aff8f086.tar.bz2 android_external_rsync-5e252dea4b2d310dbbb3a57337199836aff8f086.zip |
Optimized away a loop in hash_search().
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -217,20 +217,13 @@ static void hash_search(int f,struct sum_struct *s, /* we've found a match, but now check to see * if last_i can hint at a better match */ - for (j++; j < s->count && targets[j].t == t; j++) { - size_t i2 = targets[j].i; - if (i2 == last_i + 1) { - if (sum != s->sums[i2].sum1) - break; - if (memcmp(sum2,s->sums[i2].sum2,s->s2length) != 0) - break; - /* we've found an adjacent match - the RLL coder - * will be happy */ - i = i2; - break; - } + if (i != last_i + 1 && last_i + 1 < s->count + && sum == s->sums[last_i+1].sum1 + && memcmp(sum2, s->sums[last_i+1].sum2, s->s2length) == 0) { + /* we've found an adjacent match - the RLL coder + * will be happy */ + i = last_i + 1; } - last_i = i; matched(f,s,buf,offset,i); |