Fossil SCM

Minor optimization.

mistachkin 2016-10-03 23:23 UTC binDiffFix
Commit 9903ce5a5bc0ebe3683c6a70e7aa97c1f3b36167
1 file changed +7 -5
+7 -5
--- src/diff.c
+++ src/diff.c
@@ -195,29 +195,31 @@
195195
}
196196
if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
197197
int numws = 0;
198198
while( s<k && fossil_isspace(z[s]) ){ s++; }
199199
for(h=0, x=s; x<k; x++){
200
- if( z[x]=='\0' ){
200
+ char c = z[x];
201
+ if( c=='\0' ){
201202
fossil_free(a);
202203
return 0;
203204
}
204
- if( fossil_isspace(z[x]) ){
205
+ if( fossil_isspace(c) ){
205206
++numws;
206207
}else{
207
- h += z[x];
208
+ h += c;
208209
h *= 0x9e3779b1;
209210
}
210211
}
211212
k -= numws;
212213
}else{
213214
for(h=0, x=s; x<k; x++){
214
- if( z[x]=='\0' ){
215
+ char c = z[x];
216
+ if( c=='\0' ){
215217
fossil_free(a);
216218
return 0;
217219
}
218
- h += z[x];
220
+ h += c;
219221
h *= 0x9e3779b1;
220222
}
221223
}
222224
a[i].indent = s;
223225
a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
224226
--- src/diff.c
+++ src/diff.c
@@ -195,29 +195,31 @@
195 }
196 if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
197 int numws = 0;
198 while( s<k && fossil_isspace(z[s]) ){ s++; }
199 for(h=0, x=s; x<k; x++){
200 if( z[x]=='\0' ){
 
201 fossil_free(a);
202 return 0;
203 }
204 if( fossil_isspace(z[x]) ){
205 ++numws;
206 }else{
207 h += z[x];
208 h *= 0x9e3779b1;
209 }
210 }
211 k -= numws;
212 }else{
213 for(h=0, x=s; x<k; x++){
214 if( z[x]=='\0' ){
 
215 fossil_free(a);
216 return 0;
217 }
218 h += z[x];
219 h *= 0x9e3779b1;
220 }
221 }
222 a[i].indent = s;
223 a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
224
--- src/diff.c
+++ src/diff.c
@@ -195,29 +195,31 @@
195 }
196 if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
197 int numws = 0;
198 while( s<k && fossil_isspace(z[s]) ){ s++; }
199 for(h=0, x=s; x<k; x++){
200 char c = z[x];
201 if( c=='\0' ){
202 fossil_free(a);
203 return 0;
204 }
205 if( fossil_isspace(c) ){
206 ++numws;
207 }else{
208 h += c;
209 h *= 0x9e3779b1;
210 }
211 }
212 k -= numws;
213 }else{
214 for(h=0, x=s; x<k; x++){
215 char c = z[x];
216 if( c=='\0' ){
217 fossil_free(a);
218 return 0;
219 }
220 h += c;
221 h *= 0x9e3779b1;
222 }
223 }
224 a[i].indent = s;
225 a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
226

Keyboard Shortcuts

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