Show More
@@ -166,10 +166,17 b' static int longest_match(struct line *a,' | |||||
166 | /* loop through all lines match a[i] in b */ |
|
166 | /* loop through all lines match a[i] in b */ | |
167 | for (; j >= b1; j = b[j].n) { |
|
167 | for (; j >= b1; j = b[j].n) { | |
168 | /* does this extend an earlier match? */ |
|
168 | /* does this extend an earlier match? */ | |
169 | if (i > a1 && j > b1 && pos[j - 1].pos == i - 1) |
|
169 | for (k = 1; j - k >= b1 && i - k >= a1; k++) { | |
170 | k = pos[j - 1].len + 1; |
|
170 | /* reached an earlier match? */ | |
171 | else |
|
171 | if (pos[j - k].pos == i - k) { | |
172 | k = 1; |
|
172 | k += pos[j - k].len; | |
|
173 | break; | |||
|
174 | } | |||
|
175 | /* previous line mismatch? */ | |||
|
176 | if (a[i - k].e != b[j - k].e) | |||
|
177 | break; | |||
|
178 | } | |||
|
179 | ||||
173 | pos[j].pos = i; |
|
180 | pos[j].pos = i; | |
174 | pos[j].len = k; |
|
181 | pos[j].len = k; | |
175 |
|
182 |
General Comments 0
You need to be logged in to leave comments.
Login now