Check-in [4db464a748]
Not logged in
Overview

SHA1 Hash:4db464a748d9895ee3ae0a3091808fe518ae5000
Date: 2007-11-21 16:03:19
User: drh
Comment:Fix a bug in the unified diff generator.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/diff.c from [fe83b4caec] to [0027a16891].

@@ -370,16 +370,18 @@
   */
   if( pOut ){
     int a = 0;    /* Index of next line in A[] */
     int b = 0;    /* Index of next line in B[] */
     int nr;       /* Number of COPY/DELETE/INSERT triples to process */
+    int mxr;      /* Maximum value for r */
     int na, nb;   /* Number of lines shown from A and B */
     int i, j;     /* Loop counters */
     int m;        /* Number of lines to output */
     int skip;     /* Number of lines to skip */
 
-    for(r=0; R[r+1] || R[r+2] || R[r+3]; r += 3*nr){
+    for(mxr=0; R[mxr+1] || R[mxr+2] || R[mxr+3]; mxr += 3){}
+    for(r=0; r<mxr; r += 3*nr){
       /* Figure out how many triples to show in a single block */
       for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<nContext*2; nr++){}
       DEBUG( printf("r=%d nr=%d\n", r, nr); )
 
       /* For the current block comprising nr triples, figure out