]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simplifications to expr.c in support of full coverage testing. (CVS 6665)
authordrh <drh@noemail.net>
Thu, 21 May 2009 20:41:32 +0000 (20:41 +0000)
committerdrh <drh@noemail.net>
Thu, 21 May 2009 20:41:32 +0000 (20:41 +0000)
FossilOrigin-Name: 309adb5e22af2735b69460c164d870aea99c6da3

manifest
manifest.uuid
src/expr.c

index 47f30e680867642a3858f0542b9b7804746ddda9..a0cad227478fa4fe037c9c013ff788c7ae0b0d16 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\sCLI\sin\sthe\s".dump"\scommand,\sdo\snot\sattempt\sto\sclear\sthe\ssqlite_sequence\ntable\suntil\sthe\sfirst\srow\sof\scontent\sof\sthat\stable\sis\sseen.\s\sTicket\s#3867\s(CVS\s6664)
-D 2009-05-21T15:15:01
+C Simplifications\sto\sexpr.c\sin\ssupport\sof\sfull\scoverage\stesting.\s(CVS\s6665)
+D 2009-05-21T20:41:32
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -114,7 +114,7 @@ F src/callback.c 57359fa93de47c341b6b8ee504a88ff276397686
 F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
 F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
 F src/delete.c a0a0932eea77471ab243337026abbce444024c43
-F src/expr.c 79f1cb93526a5f64625b7979893e506012fe26d7
+F src/expr.c a6d3c715082d535f54960e19f17687a22567c6a7
 F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
 F src/func.c f667fe886309707c7178542073bb0ced00a9fae7
 F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
@@ -729,7 +729,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P a0028d4808275cb1d020d56344d90b2a04603f4d
-R a6c6ee687310ceffc123f04a82263b69
+P bedd5ad1942021ef2b3defde3ff3e8aead86137e
+R c10e03fcec7219b961eadb057b40a247
 U drh
-Z 3221b6689b30d8e2afed14ae03e93796
+Z c4baf8d6263d95449794bc3f1691d7fd
index a07983682e8cdb9bbaf686c0c0eac5ff598b8094..988353d173855a4cd9ffcfea623c825f45d48294 100644 (file)
@@ -1 +1 @@
-bedd5ad1942021ef2b3defde3ff3e8aead86137e
\ No newline at end of file
+309adb5e22af2735b69460c164d870aea99c6da3
\ No newline at end of file
index b6aba99217f13a9a4073f9fb4bcd3a9bee39be24..5e1c7c59f7234992a5af580f2c39d065747d93cc 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.434 2009/05/11 20:53:29 drh Exp $
+** $Id: expr.c,v 1.435 2009/05/21 20:41:32 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -86,7 +86,7 @@ Expr *sqlite3ExprSetColl(Parse *pParse, Expr *pExpr, Token *pCollName){
 CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
   CollSeq *pColl = 0;
   Expr *p = pExpr;
-  while( p ){
+  while( ALWAYS(p) ){
     int op;
     pColl = p->pColl;
     if( pColl ) break;
@@ -412,7 +412,7 @@ Expr *sqlite3Expr(
       sqlite3TokenCopy(db, &pNew->token, pToken);
       if( pNew->token.z ){
         pNew->token.n = sqlite3Dequote((char*)pNew->token.z);
-        assert( pNew->token.n==(unsigned)sqlite3Strlen30((char*)pNew->token.z) );
+        assert( pNew->token.n==(unsigned)sqlite3Strlen30((char*)pNew->token.z));
       }
       if( c=='"' ) pNew->flags |= EP_DblQuoted;
     }else{
@@ -468,13 +468,11 @@ Expr *sqlite3PExpr(
 ** that memory location as needed.
 */
 Expr *sqlite3RegisterExpr(Parse *pParse, Token *pToken){
-  Vdbe *v = pParse->pVdbe;
   Expr *p;
   if( pParse->nested==0 ){
     sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", pToken);
     return sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);
   }
-  if( v==0 ) return 0;
   p = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, pToken);
   if( p==0 ){
     return 0;  /* Malloc failed */
@@ -548,7 +546,7 @@ Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){
 ** sure "nnn" is not too be to avoid a denial of service attack when
 ** the SQL statement comes from an external source.
 **
-** Wildcards of the form ":aaa" or "$aaa" are assigned the same number
+** Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number
 ** as the previous instance of the same wildcard.  Or if this is the first
 ** instance of the wildcard, the next sequenial variable number is
 ** assigned.
@@ -582,7 +580,7 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
       pParse->nVar = i;
     }
   }else{
-    /* Wildcards of the form ":aaa" or "$aaa".  Reuse the same variable
+    /* Wildcards like ":aaa", "$aaa" or "@aaa".  Reuse the same variable
     ** number as the prior appearance of the same name, or if the name
     ** has never appeared before, reuse the same variable number
     */
@@ -590,10 +588,9 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
     u32 n;
     n = pToken->n;
     for(i=0; i<pParse->nVarExpr; i++){
-      Expr *pE;
-      if( (pE = pParse->apVarExpr[i])!=0
-          && pE->token.n==n
-          && memcmp(pE->token.z, pToken->z, n)==0 ){
+      Expr *pE = pParse->apVarExpr[i];
+      assert( pE!=0 );
+      if( pE->token.n==n && memcmp(pE->token.z, pToken->z, n)==0 ){
         pExpr->iTable = pE->iTable;
         break;
       }