why variable last_i is needed in match.c rsync source ?

Kim Jongtae javu at enpia.net
Sat Mar 23 22:25:30 EST 2002


 Hi all

  I see the rsync source and rsync makes hashing table and search  hashing
table tag_table to find the index of array struct sum_buf , which is a
element of struct  sum_struct.

According to the source code, variable last_i is used to encourage
adjacent matches allowing the RLL coding of the output to work more
efficiently.

Why last_i makes more efficiency?

I can't understanding what last_i makes and when last_i is used.



In file match.c below code follows.


In file match.c below code follows.

            /* 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++) {
                int i2 = targets[j].i;
                if (i2 == last_i + 1) {
                    if (sum != s->sums[i2].sum1) break;
                    if (memcmp(sum2,s->sums[i2].sum2,csum_length) != 0)
                        break;
                    /* we've found an adjacent match - the RLL coder
                       will be happy */
                    i = i2;
                    break;
                }
            }





 If you answer my question, I will thank to you..


 If you answer my question, I will thank to you..


 Bye.








More information about the rsync mailing list