From: danielk1977 Date: Tue, 29 Jul 2008 11:25:14 +0000 (+0000) Subject: Use a macro to make sure that the calls to sqlite3Utf8Read() from MemTranslate()... X-Git-Tag: version-3.6.10~685 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad76a81ed5c2e1f49be229126e8680bf16555aa0;p=thirdparty%2Fsqlite.git Use a macro to make sure that the calls to sqlite3Utf8Read() from MemTranslate() are inlined. This speeds up converting from utf8 to utf16. (CVS 5492) FossilOrigin-Name: 78a623bbb17e35bcb902d3ea1d0b963570588d2d --- diff --git a/manifest b/manifest index 2d014acf02..54d331008c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\smissing\s"finish_test"\sto\sthe\send\sof\smisc5.test.\s(CVS\s5491) -D 2008-07-29T10:26:45 +C Use\sa\smacro\sto\smake\ssure\sthat\sthe\scalls\sto\ssqlite3Utf8Read()\sfrom\sMemTranslate()\sare\sinlined.\sThis\sspeeds\sup\sconverting\sfrom\sutf8\sto\sutf16.\s(CVS\s5492) +D 2008-07-29T11:25:14 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in bbb62eecc851379aef5a48a1bf8787eb13e6ec06 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -180,7 +180,7 @@ F src/test_thread.c e297dd41db0b249646e69f97d36ec13e56e8b730 F src/tokenize.c bfdc945527a4645bf54c8bf34d1f18c019b37117 F src/trigger.c b61aaf7bff8e3763b234dbf46a1a64fb88a34e64 F src/update.c 79b77a3cc8ed5f8903a7f37055fcedd69388dcae -F src/utf.c 8d52f620a7153d90b058502124fe51d821fcdf57 +F src/utf.c a7004436a6ef2aee012ace93de274dd0f3c7624e F src/util.c afe659ccc05d1f8af9e8631dabfec3ee3a7144af F src/vacuum.c ef342828002debc97514617af3424aea8ef8522c F src/vdbe.c 78171c3fbaff3f8880012ef5eda9f862fdca936c @@ -612,7 +612,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 9ebee8401b68a2bcd49dc750ac394258d554b499 -R 16dd0f8852f68ca7931e8bea036d6a08 +P 89216b166924e831dd6264dd60f8da42cef7deee +R 511e29293a7e963d56be0131fe0a71e2 U danielk1977 -Z 00abcc948a05a4a671714b20c5fdfad3 +Z f38220753c874edc97630b57fe1c90aa diff --git a/manifest.uuid b/manifest.uuid index 024da44329..76cdf90479 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -89216b166924e831dd6264dd60f8da42cef7deee \ No newline at end of file +78a623bbb17e35bcb902d3ea1d0b963570588d2d \ No newline at end of file diff --git a/src/utf.c b/src/utf.c index e4aa6e433a..8711a4c390 100644 --- a/src/utf.c +++ b/src/utf.c @@ -12,7 +12,7 @@ ** This file contains routines used to translate between UTF-8, ** UTF-16, UTF-16BE, and UTF-16LE. ** -** $Id: utf.c,v 1.62 2008/06/27 18:59:45 mihailim Exp $ +** $Id: utf.c,v 1.63 2008/07/29 11:25:14 danielk1977 Exp $ ** ** Notes on UTF-8: ** @@ -154,27 +154,31 @@ static const unsigned char sqlite3UtfTrans1[] = { ** for unicode values 0x80 and greater. It do not change over-length ** encodings to 0xfffd as some systems recommend. */ +#define READ_UTF8(zIn, zTerm, c) \ + c = *(zIn++); \ + if( c>=0xc0 ){ \ + c = sqlite3UtfTrans1[c-0xc0]; \ + while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){ \ + c = (c<<6) + (0x3f & *(zIn++)); \ + } \ + if( c<0x80 \ + || (c&0xFFFFF800)==0xD800 \ + || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \ + } int sqlite3Utf8Read( const unsigned char *z, /* First byte of UTF-8 character */ const unsigned char *zTerm, /* Pretend this byte is 0x00 */ const unsigned char **pzNext /* Write first byte past UTF-8 char here */ ){ - int c = *(z++); - if( c>=0xc0 ){ - c = sqlite3UtfTrans1[c-0xc0]; - while( z!=zTerm && (*z & 0xc0)==0x80 ){ - c = (c<<6) + (0x3f & *(z++)); - } - if( c<0x80 - || (c&0xFFFFF800)==0xD800 - || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } - } + int c; + READ_UTF8(z, zTerm, c); *pzNext = z; return c; } + /* ** If the TRANSLATE_TRACE macro is defined, the value of each Mem is ** printed on stderr on the way into and out of sqlite3VdbeMemTranslate(). @@ -268,14 +272,16 @@ int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){ if( desiredEnc==SQLITE_UTF16LE ){ /* UTF-8 -> UTF-16 Little-endian */ while( zIn UTF-16 Big-endian */ while( zIn