Show More
@@ -177,10 +177,20 b' static int longest_match(struct bdiff_li' | |||
|
177 | 177 | |
|
178 | 178 | /* best match so far? we prefer matches closer |
|
179 | 179 | to the middle to balance recursion */ |
|
180 | if (k > mk || (k == mk && (i <= mi || i <= half))) { | |
|
180 | if (k > mk) { | |
|
181 | /* a longer match */ | |
|
181 | 182 | mi = i; |
|
182 | 183 | mj = j; |
|
183 | 184 | mk = k; |
|
185 | } else if (k == mk) { | |
|
186 | if (i > mi && i <= half) { | |
|
187 | /* same match but closer to half */ | |
|
188 | mi = i; | |
|
189 | mj = j; | |
|
190 | } else if (i == mi) { | |
|
191 | /* same i but earlier j */ | |
|
192 | mj = j; | |
|
193 | } | |
|
184 | 194 | } |
|
185 | 195 | } |
|
186 | 196 | } |
General Comments 0
You need to be logged in to leave comments.
Login now