Fossil

Check-in [5be2e9cf]
Login

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

Overview
Comment:Minor further speed-up: Only increment pointer if really needed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5be2e9cf7d44838ae42f9505afc7d38e9b22d425
User & Date: jan.nijtmans 2016-06-16 11:39:43
Context
2016-06-16
22:14
shrunk size of lead byte table for invalid_utf8, and took a shortcut to invalidate lead bytes between 0x80 & 0xBF inclusive check-in: 69328517 user: sdr tags: trunk
16:28
Add the 'project_description' variable for TH1 style scripts. check-in: 77667ca1 user: mistachkin tags: prjDesc
12:14
More optimizations, taken over from trunk. check-in: ec7f6b2e user: jan.nijtmans tags: invalid_utf8_table
11:39
Minor further speed-up: Only increment pointer if really needed. check-in: 5be2e9cf user: jan.nijtmans tags: trunk
09:44
Further invalid_utf8() improvement: Save one indirection and a check, and make the table size even smaller. check-in: 6a59dbbb user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/lookslike.c.

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
  if( n==0 ) return 0;  /* Empty file -> OK */
  c = *z;
  while( --n>0 ){
    c2 = c;
    c = *++z;
    if( c2>=0x80 ){
      const unsigned char *def = &lb_tab[(2*c2)-0x100];
      if( (c<*def++) || (c>*def++) ){
        return LOOK_INVALID; /* Invalid UTF-8 */
      }
      if( c2>=0xe0 ){
        c = (c2<<1)|3;
      }else{
        c = ' ';
      }







|







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
  if( n==0 ) return 0;  /* Empty file -> OK */
  c = *z;
  while( --n>0 ){
    c2 = c;
    c = *++z;
    if( c2>=0x80 ){
      const unsigned char *def = &lb_tab[(2*c2)-0x100];
      if( (c<*def) || (c>*++def) ){
        return LOOK_INVALID; /* Invalid UTF-8 */
      }
      if( c2>=0xe0 ){
        c = (c2<<1)|3;
      }else{
        c = ' ';
      }