reapply buffer size patch to fixup out-of-order patches. Reference: /n/atom/patch/applied/diffsync Date: Mon Sep 28 07:09:12 CES 2015 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/diff/diffreg.c Mon Sep 28 07:08:46 2015 +++ /sys/src/cmd/diff/diffreg.c Mon Sep 28 07:08:48 2015 @@ -33,7 +33,7 @@ * through the lines of file0, developing a vector klist * of "k-candidates". At step i a k-candidate is a matched * pair of lines x,y (x in file0 y in file1) such that -* there is a common subsequence of lenght k +* there is a common subsequence of length k * between the first i lines of file0 and the first y * lines of file1, but there is no such subsequence for * any smaller y. x is the earliest possible mate to y @@ -51,9 +51,9 @@ * and placed in the array J by unravel. * * With J in hand, the matches there recorded are -* check'ed against reality to assure that no spurious +* checked against reality to assure that no spurious * matches have crept in due to hashing. If they have, -* they are broken, and "jackpot " is recorded--a harmless +* they are broken, and "jackpot" is recorded--a harmless * matter except that a true match for a spuriously * mated line may now be unnecessarily reported as a change. * @@ -188,8 +188,14 @@ newcand(int x, int y, int pred) { struct cand *q; + static int nalloc; - clist = REALLOC(clist, struct cand, (clen+1)); + if(clen == nalloc){ + if(nalloc == 0) + nalloc = 1; + nalloc <<= 1; + } + clist = REALLOC(clist, struct cand, nalloc); q = clist + clen; q->x = x; q->y = y; @@ -316,7 +322,7 @@ flushchanges(); } -#define BUF 4096 +#define BUF 32768 static int cmp(Biobuf* b1, Biobuf* b2) {