Fossil

Check-in [9903ce5a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor optimization.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | binDiffFix
Files: files | file ages | folders
SHA1: 9903ce5a5bc0ebe3683c6a70e7aa97c1f3b36167
User & Date: mistachkin 2016-10-03 23:23:56
Context
2016-10-04
02:43
Adopt the diff algorithm changes from trunk. check-in: f9f2d769 user: mistachkin tags: binDiffFix
2016-10-03
23:23
Minor optimization. check-in: 9903ce5a user: mistachkin tags: binDiffFix
23:18
Further improve clarity. check-in: 11e2c6e6 user: mistachkin tags: binDiffFix
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

193
194
195
196
197
198
199

200
201
202
203
204
205
206
207
208
209
210
211
212
213

214
215
216
217
218
219
220
221
222
223
224
225
    if( diffFlags & DIFF_IGNORE_EOLWS ){
      while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
    }
    if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
      int numws = 0;
      while( s<k && fossil_isspace(z[s]) ){ s++; }
      for(h=0, x=s; x<k; x++){

        if( z[x]=='\0' ){
          fossil_free(a);
          return 0;
        }
        if( fossil_isspace(z[x]) ){
          ++numws;
        }else{
          h += z[x];
          h *= 0x9e3779b1;
        }
      }
      k -= numws;
    }else{
      for(h=0, x=s; x<k; x++){

        if( z[x]=='\0' ){
          fossil_free(a);
          return 0;
        }
        h += z[x];
        h *= 0x9e3779b1;
      }
    }
    a[i].indent = s;
    a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
    h2 = h % nLine;
    a[i].iNext = a[h2].iHash;







>
|



|


|






>
|



|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
    if( diffFlags & DIFF_IGNORE_EOLWS ){
      while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
    }
    if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
      int numws = 0;
      while( s<k && fossil_isspace(z[s]) ){ s++; }
      for(h=0, x=s; x<k; x++){
        char c = z[x];
        if( c=='\0' ){
          fossil_free(a);
          return 0;
        }
        if( fossil_isspace(c) ){
          ++numws;
        }else{
          h += c;
          h *= 0x9e3779b1;
        }
      }
      k -= numws;
    }else{
      for(h=0, x=s; x<k; x++){
        char c = z[x];
        if( c=='\0' ){
          fossil_free(a);
          return 0;
        }
        h += c;
        h *= 0x9e3779b1;
      }
    }
    a[i].indent = s;
    a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
    h2 = h % nLine;
    a[i].iNext = a[h2].iHash;