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]
Commit
1274c97d700ed05fbb60d327fa758562824bc280
Parent
9df71fe36c00214…
1 file changed
+2
-2
+2
-2
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -220,12 +220,12 @@ | ||
| 220 | 220 | */ |
| 221 | 221 | |
| 222 | 222 | static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){ |
| 223 | 223 | int a = pA->indent, b = pB->indent; |
| 224 | 224 | 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; | |
| 227 | 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| 228 | 228 | while( b<pB->n && fossil_isspace(pB->z[b])) ++b; |
| 229 | 229 | } |
| 230 | 230 | return pA->n-a == pB->n-b; |
| 231 | 231 | } |
| 232 | 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( 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 |