Fossil SCM
Performance optimization in the control artifact parser.
Commit
3d802ec514f6e48414e749b3e8821f8b091d73522bd90db40bf54d06c5fcb70e
Parent
6d3daf74e385072…
1 file changed
+7
-8
+7
-8
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -345,20 +345,19 @@ | ||
| 345 | 345 | /* |
| 346 | 346 | ** Return a pointer to the next token. The token is zero-terminated. |
| 347 | 347 | ** Return NULL if there are no more tokens on the current line. |
| 348 | 348 | */ |
| 349 | 349 | static char *next_token(ManifestText *p, int *pLen){ |
| 350 | - char *z; | |
| 351 | 350 | char *zStart; |
| 352 | - int c; | |
| 351 | + int n; | |
| 353 | 352 | if( p->atEol ) return 0; |
| 354 | - zStart = z = p->z; | |
| 355 | - while( (c=(*z))!=' ' && c!='\n' ){ z++; } | |
| 356 | - *z = 0; | |
| 357 | - p->z = &z[1]; | |
| 358 | - p->atEol = c=='\n'; | |
| 359 | - if( pLen ) *pLen = z - zStart; | |
| 353 | + zStart = p->z; | |
| 354 | + n = strcspn(p->z, " \n"); | |
| 355 | + p->atEol = p->z[n]=='\n'; | |
| 356 | + p->z[n] = 0; | |
| 357 | + p->z += n+1; | |
| 358 | + if( pLen ) *pLen = n; | |
| 360 | 359 | return zStart; |
| 361 | 360 | } |
| 362 | 361 | |
| 363 | 362 | /* |
| 364 | 363 | ** Return the card-type for the next card. Or, return 0 if there are no |
| 365 | 364 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -345,20 +345,19 @@ | |
| 345 | /* |
| 346 | ** Return a pointer to the next token. The token is zero-terminated. |
| 347 | ** Return NULL if there are no more tokens on the current line. |
| 348 | */ |
| 349 | static char *next_token(ManifestText *p, int *pLen){ |
| 350 | char *z; |
| 351 | char *zStart; |
| 352 | int c; |
| 353 | if( p->atEol ) return 0; |
| 354 | zStart = z = p->z; |
| 355 | while( (c=(*z))!=' ' && c!='\n' ){ z++; } |
| 356 | *z = 0; |
| 357 | p->z = &z[1]; |
| 358 | p->atEol = c=='\n'; |
| 359 | if( pLen ) *pLen = z - zStart; |
| 360 | return zStart; |
| 361 | } |
| 362 | |
| 363 | /* |
| 364 | ** Return the card-type for the next card. Or, return 0 if there are no |
| 365 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -345,20 +345,19 @@ | |
| 345 | /* |
| 346 | ** Return a pointer to the next token. The token is zero-terminated. |
| 347 | ** Return NULL if there are no more tokens on the current line. |
| 348 | */ |
| 349 | static char *next_token(ManifestText *p, int *pLen){ |
| 350 | char *zStart; |
| 351 | int n; |
| 352 | if( p->atEol ) return 0; |
| 353 | zStart = p->z; |
| 354 | n = strcspn(p->z, " \n"); |
| 355 | p->atEol = p->z[n]=='\n'; |
| 356 | p->z[n] = 0; |
| 357 | p->z += n+1; |
| 358 | if( pLen ) *pLen = n; |
| 359 | return zStart; |
| 360 | } |
| 361 | |
| 362 | /* |
| 363 | ** Return the card-type for the next card. Or, return 0 if there are no |
| 364 |