Fossil SCM

Performance optimization in the control artifact parser.

drh 2019-09-12 16:31 trunk
Commit 3d802ec514f6e48414e749b3e8821f8b091d73522bd90db40bf54d06c5fcb70e
1 file changed +7 -8
+7 -8
--- src/manifest.c
+++ src/manifest.c
@@ -345,20 +345,19 @@
345345
/*
346346
** Return a pointer to the next token. The token is zero-terminated.
347347
** Return NULL if there are no more tokens on the current line.
348348
*/
349349
static char *next_token(ManifestText *p, int *pLen){
350
- char *z;
351350
char *zStart;
352
- int c;
351
+ int n;
353352
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;
360359
return zStart;
361360
}
362361
363362
/*
364363
** Return the card-type for the next card. Or, return 0 if there are no
365364
--- 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

Keyboard Shortcuts

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