Fossil SCM

Fix function same_dline_ignore_allws(), for the case where one side of the diff was an empty line. Example where it went wrong: [/fdiff?v1=d5e0c2dc93&v2=7ee7dd0a42&sbs=1&w]

jan.nijtmans 2014-04-28 11:00 trunk
Commit 1274c97d700ed05fbb60d327fa758562824bc280
1 file changed +2 -2
+2 -2
--- src/diff.c
+++ src/diff.c
@@ -220,12 +220,12 @@
220220
*/
221221
222222
static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){
223223
int a = pA->indent, b = pB->indent;
224224
if( pA->h==pB->h ){
225
- while( a<pA->n && b<pB->n ){
226
- if( pA->z[a++] != pB->z[b++] ) return 0;
225
+ while( a<pA->n || b<pB->n ){
226
+ if( a<pA->n && b<pB->n && pA->z[a++] != pB->z[b++] ) return 0;
227227
while( a<pA->n && fossil_isspace(pA->z[a])) ++a;
228228
while( b<pB->n && fossil_isspace(pB->z[b])) ++b;
229229
}
230230
return pA->n-a == pB->n-b;
231231
}
232232
--- src/diff.c
+++ src/diff.c
@@ -220,12 +220,12 @@
220 */
221
222 static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){
223 int a = pA->indent, b = pB->indent;
224 if( pA->h==pB->h ){
225 while( a<pA->n && b<pB->n ){
226 if( pA->z[a++] != pB->z[b++] ) return 0;
227 while( a<pA->n && fossil_isspace(pA->z[a])) ++a;
228 while( b<pB->n && fossil_isspace(pB->z[b])) ++b;
229 }
230 return pA->n-a == pB->n-b;
231 }
232
--- src/diff.c
+++ src/diff.c
@@ -220,12 +220,12 @@
220 */
221
222 static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){
223 int a = pA->indent, b = pB->indent;
224 if( pA->h==pB->h ){
225 while( a<pA->n || b<pB->n ){
226 if( a<pA->n && b<pB->n && pA->z[a++] != pB->z[b++] ) return 0;
227 while( a<pA->n && fossil_isspace(pA->z[a])) ++a;
228 while( b<pB->n && fossil_isspace(pB->z[b])) ++b;
229 }
230 return pA->n-a == pB->n-b;
231 }
232

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button