]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid unnecessary strlen() calls in the OP_String opcode. (CVS 2768)
authordrh <drh@noemail.net>
Wed, 16 Nov 2005 04:34:32 +0000 (04:34 +0000)
committerdrh <drh@noemail.net>
Wed, 16 Nov 2005 04:34:32 +0000 (04:34 +0000)
FossilOrigin-Name: 2e195e96bcbad104da09ebe6cef617e0e9ef1884

manifest
manifest.uuid
src/vdbe.c

index 23a99a076579af9050521c2a73e260a8c18cbb89..d88db416fc8ce3fdeb0de8d4c05aa565d1119979 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sbug\sin\sUTF-16\shandling\sintroduced\sby\sthe\sprevious\scheck-in.\s(CVS\s2767)
-D 2005-11-15T02:14:01
+C Avoid\sunnecessary\sstrlen()\scalls\sin\sthe\sOP_String\sopcode.\s(CVS\s2768)
+D 2005-11-16T04:34:32
 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -81,7 +81,7 @@ F src/update.c fec7665138ccf2a2133f11dcd24c1134c6b33526
 F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
 F src/util.c 48fecbbef4391d102a23096d32f0d74173428406
 F src/vacuum.c baae8681282c7a03900043043dc7ce07d43b5a1e
-F src/vdbe.c c4ff8b6ccfc41e0d49278ee90d3ee5090a7ea486
+F src/vdbe.c 3b73d37dc1eec230385a58534573f0aa21fd4285
 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
 F src/vdbeInt.h 7824d7be3b659ad177c8f151d9612b45b1805878
 F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd
@@ -317,7 +317,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P ce06c123d0c5663dbaf263c2e0aaf5d9cdeb2ccd
-R ac5513052a8e6c0ee190e3f8cafae3b1
+P 25fa16a2e1f324790f4b293df5d7142575034428
+R 6947ef477ab782876c329e5cbcb856d9
 U drh
-Z ef913d08214f6e274bc502dca166bab0
+Z 45b9b11236dc8332f514b54b24426e7f
index b8c5e1522fc2b7459d486d96eed5a8b5dd6793bc..4a4d995c1a08ba5bb30434c8b4163d2e1b43c36e 100644 (file)
@@ -1 +1 @@
-25fa16a2e1f324790f4b293df5d7142575034428
\ No newline at end of file
+2e195e96bcbad104da09ebe6cef617e0e9ef1884
\ No newline at end of file
index 26e938ebb3a46d767a9b74f85c5bd3b79613ae72..36870b743b19f636882c49cbba0bfb9593f8f6a4 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.497 2005/11/15 02:14:01 drh Exp $
+** $Id: vdbe.c,v 1.498 2005/11/16 04:34:32 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -638,14 +638,16 @@ case OP_Real: {            /* same as TK_FLOAT, */
 
 /* Opcode: String8 * * P3
 **
-** P3 points to a nul terminated UTF-8 string. This opcode is transformed
+** P3 points to a nul terminated UTF-8 string that is P1 character long
+** (not counting the nul terminator). This opcode is transformed
 ** into an OP_String before it is executed for the first time.
 */
 case OP_String8: {         /* same as TK_STRING */
-#ifndef SQLITE_OMIT_UTF16
+  assert( pOp->p3!=0 );
   pOp->opcode = OP_String;
+  pOp->p1 = strlen(pOp->p3);
 
-  assert( pOp->p3!=0 );
+#ifndef SQLITE_OMIT_UTF16
   if( db->enc!=SQLITE_UTF8 ){
     pTos++;
     sqlite3VdbeMemSetStr(pTos, pOp->p3, -1, SQLITE_UTF8, SQLITE_STATIC);
@@ -658,33 +660,23 @@ case OP_String8: {         /* same as TK_STRING */
     }
     pOp->p3type = P3_DYNAMIC;
     pOp->p3 = pTos->z;
+    pOp->p1 *= 2;
     break;
   }
 #endif
   /* Otherwise fall through to the next case, OP_String */
 }
   
-/* Opcode: String * * P3
+/* Opcode: String P1 * P3
 **
-** The string value P3 is pushed onto the stack.  If P3==0 then a
-** NULL is pushed onto the stack. P3 is assumed to be a nul terminated
-** string encoded with the database native encoding.
+** The string value P3 of length P1 is pushed onto the stack.
 */
 case OP_String: {
   pTos++;
   assert( pOp->p3!=0 );
   pTos->flags = MEM_Str|MEM_Static|MEM_Term;
   pTos->z = pOp->p3;
-#ifndef SQLITE_OMIT_UTF16
-  if( db->enc==SQLITE_UTF8 ){
-    pTos->n = strlen(pTos->z);
-  }else{
-    pTos->n  = sqlite3utf16ByteLen(pTos->z, -1);
-  }
-#else
-  assert( db->enc==SQLITE_UTF8 );
-  pTos->n = strlen(pTos->z);
-#endif
+  pTos->n = pOp->p1;
   pTos->enc = db->enc;
   break;
 }