]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix some more small problems introduced by recent refactoring. (CVS 4235)
authordanielk1977 <danielk1977@noemail.net>
Thu, 16 Aug 2007 11:36:15 +0000 (11:36 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 16 Aug 2007 11:36:15 +0000 (11:36 +0000)
FossilOrigin-Name: 5e2795d0eb8ea2a076b3014cfa9096aa7e8f69d7

manifest
manifest.uuid
src/expr.c
src/test3.c
src/test8.c
src/test_tclvar.c
src/vdbeapi.c
src/where.c

index 910fbd3bc3cb286891b8be3f988932e60dca3b99..02e862a461cc9c8a93a33a35f5e79971058bb4bb 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Replace\sa\sfew\ssqlite3_malloc()\scalls\sthat\sshould\sbe\ssqlite3MallocZero().\s(CVS\s4234)
-D 2007-08-16T10:36:34
+C Fix\ssome\smore\ssmall\sproblems\sintroduced\sby\srecent\srefactoring.\s(CVS\s4235)
+D 2007-08-16T11:36:15
 F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -77,7 +77,7 @@ F src/complete.c ea63834e798a0ab14159bdc6e6cabc3df21aa346
 F src/date.c c44aa498ee9a289ba2b2c62e8269b74b1b81351f
 F src/delete.c 849846d06d29851dde0d9f424a5de5817eb140d1
 F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
-F src/expr.c beb6b40974ddb22d683b8239d635c37f28b16f95
+F src/expr.c a304c22073fb120f9c788ed34393089623c272e2
 F src/func.c 472c0610164180624ff5aa51b0521a331bfef11b
 F src/hash.c 2f322979071dd2bdba7503b5276d66f028744382
 F src/hash.h 3ad3da76bfb954978d227bf495568b0e6da2c19e
@@ -120,12 +120,12 @@ F src/table.c c725e47f6f3092b9a7b569fc58e408e2173ee008
 F src/tclsqlite.c 0606c4f31711492eb4d7480a981eebb80914f3d9
 F src/test1.c f2969f28574433743f7439da62f0cfd9063fc26b
 F src/test2.c 4db48e4a487d4d18c2926d9600875613ad286ba8
-F src/test3.c c337cff70c3bf9c30f77e953106ef7ddf655dd51
+F src/test3.c b87e8fcce45e1d3153aae9f04236076b7707a714
 F src/test4.c d22cb3ab4f9fdfd0a595b70d5328cee923b7322c
 F src/test5.c 7bc8a87c2b6fd076ec2ca9972946e71a367883ad
 F src/test6.c 14919eef8504da6814db7ab19608c786d836fcb2
 F src/test7.c 91d914c2c2b2806157213f41f4185ad3a4970c07
-F src/test8.c 0dc64e1a676df556cbcc3f7fcbaa583d7f234826
+F src/test8.c 719c284607c1e91a893f5425df1e92b74c859aef
 F src/test9.c c0f38f7795cc51d37db6c63874d90f40f10d0f0e
 F src/test_async.c 871ffbe4a520be74b403aca87aa622ebdb690232
 F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
@@ -137,7 +137,7 @@ F src/test_malloc.c d9ba6be85f9c4a439b19f6e0a72d91c369d72c63
 F src/test_md5.c d9f828765b242ff86f58cd879259c3da4eaede02
 F src/test_schema.c 12c9de7661d6294eec2d57afbb52e2af1128084f
 F src/test_server.c 76c0baf509abe65ca6e5c7974ab0097cfdd8b833
-F src/test_tclvar.c 51f69f526ed4a044dc7c13c7badccd33cb41132b
+F src/test_tclvar.c 160290ba5c19964da7cb97defc6c104712074b69
 F src/tokenize.c 3a3fd71cfb2abb8e11ed6ab6b764b790c534defc
 F src/trigger.c dccc6fbf37d12193c90ede5b026bbd195d505ff4
 F src/update.c e89b980b443d44b68bfc0b1746cdb6308e049ac9
@@ -147,13 +147,13 @@ F src/vacuum.c f45bd9d3aad8d68bb3b85cf89d7a797be5075fde
 F src/vdbe.c 10052a4f1e42e629aee0466b40983e2b61e0295a
 F src/vdbe.h 001c5b257567c1d3de7feb2203aac71d0d7b16a3
 F src/vdbeInt.h e0bd068cf607dcb10021aefa9390b96f56fc3e03
-F src/vdbeapi.c ca82e14ac4ef0c15d7ed8851b0bf9377d7eb0058
+F src/vdbeapi.c a503e3762826d55e808b28393ae1d7b0fa36b1e9
 F src/vdbeaux.c aa079bb65d3ebe81eab4765c26c3e69deabc6825
 F src/vdbeblob.c cf9ee3c7d9977cbd896f8b118da4fb4268637f4f
 F src/vdbefifo.c 334c838c8f42d61a94813d136019ee566b5dc2f6
 F src/vdbemem.c 019952d44066a24aef70ca8c284cfd2d1073c398
 F src/vtab.c 8d65679ab4ef3efce5d946d7f2d2dac5a33313b4
-F src/where.c b5af62312d2ac6b22897cd0f06fb0eca477d8589
+F src/where.c 2776a0caf8cbbfd6ec79cfb1cd9bc25074055e5e
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/all.test 56bc526a6cbb262c5b678dd606de8c92ae39705e
@@ -529,7 +529,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 77b1671351fe94b0ebc126a63140643deae2aa64
-R 75b32abf10755f4737e84372abb73bce
+P 384d0ca9bc96309e7057e4a2bd4bac5049485e9b
+R 1aa8628043fcd7569e15be343f911cb3
 U danielk1977
-Z 839a6b4935ab0a1b59398b298a99bcf2
+Z f796049af9ef1de328748803dd52f7d3
index f5fc7756643e20d2c97766ba0686a7e61eb938fc..b326f4bc7ad268aa495e8d9d10372f1eb2f95a4c 100644 (file)
@@ -1 +1 @@
-384d0ca9bc96309e7057e4a2bd4bac5049485e9b
\ No newline at end of file
+5e2795d0eb8ea2a076b3014cfa9096aa7e8f69d7
\ No newline at end of file
index 5c281fbacf49218522e37a1860df852911c2f5c0..d7acec8401c76d48397731bdcefc2e91b3010bde 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.305 2007/08/16 10:09:03 danielk1977 Exp $
+** $Id: expr.c,v 1.306 2007/08/16 11:36:15 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -528,6 +528,7 @@ ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p){
   if( p==0 ) return 0;
   pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
   if( pNew==0 ) return 0;
+  pNew->iECursor = 0;
   pNew->nExpr = pNew->nAlloc = p->nExpr;
   pNew->a = pItem = sqlite3DbMallocRaw(db,  p->nExpr*sizeof(p->a[0]) );
   if( pItem==0 ){
index 53cdc17f2f96fd1ebc713bf108048c4ce582407f..fa174b4e1a9f4e5eb46dca273da1fa25094178da 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test3.c,v 1.77 2007/08/16 10:09:03 danielk1977 Exp $
+** $Id: test3.c,v 1.78 2007/08/16 11:36:15 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "pager.h"
@@ -1058,7 +1058,7 @@ static int btree_data(
   rc = sqlite3BtreeData(pCur, 0, n, zBuf);
   if( rc ){
     Tcl_AppendResult(interp, errorName(rc), 0);
-    free(zBuf);
+    sqlite3_free(zBuf);
     return TCL_ERROR;
   }
   zBuf[n] = 0;
index 5f3074b5916a3feec63e978297814d6b2de8f05e..70c6c57f119eee6890a439122b48d3bd0593b3dd 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test8.c,v 1.50 2007/08/16 10:09:03 danielk1977 Exp $
+** $Id: test8.c,v 1.51 2007/08/16 11:36:15 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -163,7 +163,7 @@ static int getColumnNames(
     for(ii=0; ii<nCol; ii++){
       nBytes += (strlen(sqlite3_column_name(pStmt, ii)) + 1);
     }
-    aCol = (char **)sqlite3_malloc(nBytes);
+    aCol = (char **)sqlite3MallocZero(nBytes);
     if( !aCol ){
       rc = SQLITE_NOMEM;
       goto out;
@@ -213,7 +213,7 @@ static int getIndexArray(
   char *zSql;
 
   /* Allocate space for the index array */
-  aIndex = (int *)sqlite3_malloc(sizeof(int) * nCol);
+  aIndex = (int *)sqlite3MallocZero(sizeof(int) * nCol);
   if( !aIndex ){
     rc = SQLITE_NOMEM;
     goto get_index_array_out;
@@ -364,7 +364,7 @@ static int echoConstructor(
   echo_vtab *pVtab;
 
   /* Allocate the sqlite3_vtab/echo_vtab structure itself */
-  pVtab = sqlite3_malloc( sizeof(*pVtab) );
+  pVtab = sqlite3MallocZero( sizeof(*pVtab) );
   if( !pVtab ){
     return SQLITE_NOMEM;
   }
@@ -498,7 +498,7 @@ static int echoDestroy(sqlite3_vtab *pVtab){
 */
 static int echoOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
   echo_cursor *pCur;
-  pCur = sqlite3_malloc(sizeof(echo_cursor));
+  pCur = sqlite3MallocZero(sizeof(echo_cursor));
   *ppCursor = (sqlite3_vtab_cursor *)pCur;
   return (pCur ? SQLITE_OK : SQLITE_NOMEM);
 }
@@ -528,15 +528,17 @@ static int echoEof(sqlite3_vtab_cursor *cur){
 ** Echo virtual table module xNext method.
 */
 static int echoNext(sqlite3_vtab_cursor *cur){
-  int rc;
+  int rc = SQLITE_OK;
   echo_cursor *pCur = (echo_cursor *)cur;
-  rc = sqlite3_step(pCur->pStmt);
 
-  if( rc==SQLITE_ROW ){
-    rc = SQLITE_OK;
-  }else{
-    rc = sqlite3_finalize(pCur->pStmt);
-    pCur->pStmt = 0;
+  if( pCur->pStmt ){
+    rc = sqlite3_step(pCur->pStmt);
+    if( rc==SQLITE_ROW ){
+      rc = SQLITE_OK;
+    }else{
+      rc = sqlite3_finalize(pCur->pStmt);
+      pCur->pStmt = 0;
+    }
   }
 
   return rc;
index 86e762219557eff83640720c8bb92cc713ca918e..03e2ca64afdf4b9cc5cb89768c9a96b61a9991bc 100644 (file)
@@ -16,7 +16,7 @@
 ** The emphasis of this file is a virtual table that provides
 ** access to TCL variables.
 **
-** $Id: test_tclvar.c,v 1.12 2007/08/16 04:30:40 drh Exp $
+** $Id: test_tclvar.c,v 1.13 2007/08/16 11:36:15 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -58,7 +58,7 @@ static int tclvarConnect(
   tclvar_vtab *pVtab;
   static const char zSchema[] = 
      "CREATE TABLE whatever(name TEXT, arrayname TEXT, value TEXT)";
-  pVtab = sqlite3_malloc( sizeof(*pVtab) );
+  pVtab = sqlite3MallocZero( sizeof(*pVtab) );
   if( pVtab==0 ) return SQLITE_NOMEM;
   *ppVtab = &pVtab->base;
   pVtab->interp = (Tcl_Interp *)pAux;
@@ -79,7 +79,7 @@ static int tclvarDisconnect(sqlite3_vtab *pVtab){
 */
 static int tclvarOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
   tclvar_cursor *pCur;
-  pCur = sqlite3_malloc(sizeof(tclvar_cursor));
+  pCur = sqlite3MallocZero(sizeof(tclvar_cursor));
   *ppCursor = &pCur->base;
   return SQLITE_OK;
 }
index 6b80796a0ec692b8645e8d87a966fb4d9201a0cc..948d4b0428e8ee9479eed89dd29e819ccd6f2584 100644 (file)
@@ -394,6 +394,7 @@ void sqlite3_set_auxdata(
 
   pVdbeFunc = pCtx->pVdbeFunc;
   if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){
+    int nAux = (pVdbeFunc ? pVdbeFunc->nAux : 0);
     int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg;
     pVdbeFunc = sqlite3_realloc(pVdbeFunc, nMalloc);
     if( !pVdbeFunc ){
@@ -401,8 +402,7 @@ void sqlite3_set_auxdata(
       goto failed;
     }
     pCtx->pVdbeFunc = pVdbeFunc;
-    memset(&pVdbeFunc->apAux[pVdbeFunc->nAux], 0, 
-             sizeof(struct AuxData)*(iArg+1-pVdbeFunc->nAux));
+    memset(&pVdbeFunc->apAux[nAux], 0, sizeof(struct AuxData)*(iArg+1-nAux));
     pVdbeFunc->nAux = iArg+1;
     pVdbeFunc->pFunc = pCtx->pFunc;
   }
index d7ddc4ceb9c7bc9aca7adf23c3cb70e257b87f28..65c7dbfe2eaf14cfe8e11421a4569295fcbb6bd2 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.256 2007/08/16 10:09:03 danielk1977 Exp $
+** $Id: where.c,v 1.257 2007/08/16 11:36:15 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -1260,7 +1260,7 @@ static double bestVirtualIndex(
 
     /* Allocate the sqlite3_index_info structure
     */
-    pIdxInfo = sqlite3_malloc( sizeof(*pIdxInfo)
+    pIdxInfo = sqlite3MallocZero( sizeof(*pIdxInfo)
                              + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm
                              + sizeof(*pIdxOrderBy)*nOrderBy );
     if( pIdxInfo==0 ){