Fossil

Check-in [0aaefeab]
Login

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

Overview
Comment:Use strchr() to improve the performance of defossilize().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0aaefeaba1bbca5811b7e4cb946eb2f1a2afebeeaca35d76fac05d014b43c25f
User & Date: drh 2019-09-12 17:11:07
Context
2019-09-12
17:51
Add the optimized file_is_simple_pathname_nonstrict() as an alternative to file_is_simple_pathname() when parsing manifests. check-in: b4aadf2c user: drh tags: trunk
17:11
Use strchr() to improve the performance of defossilize(). check-in: 0aaefeab user: drh tags: trunk
16:51
Use strspn() to improve the performance of validate16(). check-in: c550d6e0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/encode.c.

312
313
314
315
316
317
318
319
320

321
322
323
324
325
326
327
}

/*
** Decode a fossilized string in-place.
*/
void defossilize(char *z){
  int i, j, c;
  for(i=0; (c=z[i])!=0 && c!='\\'; i++){}
  if( c==0 ) return;

  for(j=i; (c=z[i])!=0; i++){
    if( c=='\\' && z[i+1] ){
      i++;
      switch( z[i] ){
        case 'n':  c = '\n';  break;
        case 's':  c = ' ';   break;
        case 't':  c = '\t';  break;







|
|
>







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
}

/*
** Decode a fossilized string in-place.
*/
void defossilize(char *z){
  int i, j, c;
  char *zSlash = strchr(z, '\\');
  if( zSlash==0 ) return;
  i = zSlash - z;
  for(j=i; (c=z[i])!=0; i++){
    if( c=='\\' && z[i+1] ){
      i++;
      switch( z[i] ){
        case 'n':  c = '\n';  break;
        case 's':  c = ' ';   break;
        case 't':  c = '\t';  break;