##// END OF EJS Templates
bdiff: do not use recursion / avoid stackoverflow (issue1940)
Alistair Bell -
r10500:e96597c8 stable
parent child Browse files
Show More
@@ -226,6 +226,7 b' static void recurse(struct line *a, stru'
226 226 {
227 227 int i, j, k;
228 228
229 while (1) {
229 230 /* find the longest match in this chunk */
230 231 k = longest_match(a, b, pos, a1, a2, b1, b2, &i, &j);
231 232 if (!k)
@@ -238,7 +239,10 b' static void recurse(struct line *a, stru'
238 239 l->head->b1 = j;
239 240 l->head->b2 = j + k;
240 241 l->head++;
241 recurse(a, b, pos, i + k, a2, j + k, b2, l);
242 /* tail-recursion didn't happen, so doing equivalent iteration */
243 a1 = i + k;
244 b1 = j + k;
245 }
242 246 }
243 247
244 248 static struct hunklist diff(struct line *a, int an, struct line *b, int bn)
General Comments 0
You need to be logged in to leave comments. Login now