How match.c hash_search works with multiple checksums that have identical tags

Wallace Matthews wmatthews at sepaton.com
Mon Jan 26 16:28:44 GMT 2004


I am trying to understand how match.c works. 

I am reading the code and something doesnt look quite right. This is usually a sign that I am missing something obvious.

Here is what I see.

build_hash_table uses qsort to order targets in ascending order of //tag,index// into the array of checksums.
It then accesses the targets in ascending order and writes the index at the tag's location in the tag_table. For any
set of targets with identical tags, the highest valued index is the resulting value in that location in the table.

hash_search initializes "j" from the tag_table resulting in "j" being the largest index in a group of targets with the same
tag value. The for loop that uses "j" as its primary iteration control iterates positively (ie. j++). The termination condition
for the loop is any tag value that isn't equal to the initialized tag value.

It appears to me that only the last target of a group that has an identical tag value will be processed. 

What am I missing?? 

wally


More information about the rsync mailing list