From: drh Date: Wed, 13 May 2009 17:21:13 +0000 (+0000) Subject: Changes to build.c to help facilitate full coverage testing. (CVS 6634) X-Git-Tag: version-3.6.15~116 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0449171e0c74989b86ad86262676a03f13454f8c;p=thirdparty%2Fsqlite.git Changes to build.c to help facilitate full coverage testing. (CVS 6634) FossilOrigin-Name: 264ace50bbaec3468de0e42b2b8cebf9ce1d6682 --- diff --git a/manifest b/manifest index 2cfc163212..69a8b1854e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\srun\sasync4.test\sas\spart\sof\sthe\s"journaltest"\spermutation.\sIt\sspecifically\stests\sthat\sthe\sasynchronous\sIO\sbackend\scan\sbe\sconfigured\sto\sviolate\sthe\sassumptions\smade\sby\sjournaltest.\s(CVS\s6633) -D 2009-05-13T14:46:10 +C Changes\sto\sbuild.c\sto\shelp\sfacilitate\sfull\scoverage\stesting.\s(CVS\s6634) +D 2009-05-13T17:21:14 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -109,7 +109,7 @@ F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c F src/btree.c 7c4b02afea7efb561361f20408414fec68df898c F src/btree.h 58d876d3ed944a8f4f1fd0e67024b385243fc9dd F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5 -F src/build.c e8e2f7d6cf0905a3a5681afb5cad16c3237351e5 +F src/build.c d9890c52f02a009aa7bd280218b3505e291a7670 F src/callback.c bf295cfdc065b56cc49a5f6452126dc4ffe0ff5b F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0 F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3 @@ -162,7 +162,7 @@ F src/select.c 2877098ffabd751c274aa5f993d515484d955896 F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7 F src/sqlite.h.in d028ed6e0e991d730644f0b418964df1b51e6c53 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 -F src/sqliteInt.h 0a39cbf63cc7fe54aa9a4bb053e21b5b5b7cde14 +F src/sqliteInt.h d20ac97b4daf97621d641f52ac16e8ff26fb53fd F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d @@ -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 90309008c35494c7a075fe76f7eb96b09a01d01b -R ed250caec188d75dd66a52271396a75b -U danielk1977 -Z 56e0c99958614308b534424b4ade9f10 +P b19bf39bbae96aeb6e742fb9fb1c33d0e251ad7f +R 74cc80f4c5c238b3488a2be9f1be7ad9 +U drh +Z 422ed81794fdbf61d42840503b0a04d7 diff --git a/manifest.uuid b/manifest.uuid index 739c5849d5..a4aee45a92 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b19bf39bbae96aeb6e742fb9fb1c33d0e251ad7f \ No newline at end of file +264ace50bbaec3468de0e42b2b8cebf9ce1d6682 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 2db31e60a0..b1e4aad668 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.541 2009/05/12 18:00:38 drh Exp $ +** $Id: build.c,v 1.542 2009/05/13 17:21:14 drh Exp $ */ #include "sqliteInt.h" @@ -68,10 +68,7 @@ void sqlite3TableLock( int nBytes; TableLock *p; - if( iDb<0 ){ - return; - } - + if( NEVER(iDb<0) ) return; for(i=0; inTableLock; i++){ p = &pParse->aTableLock[i]; if( p->iDb==iDb && p->iTab==iTab ){ @@ -103,9 +100,8 @@ static void codeTableLocks(Parse *pParse){ int i; Vdbe *pVdbe; - if( 0==(pVdbe = sqlite3GetVdbe(pParse)) ){ - return; - } + pVdbe = sqlite3GetVdbe(pParse); + assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */ for(i=0; inTableLock; i++){ TableLock *p = &pParse->aTableLock[i]; @@ -185,7 +181,7 @@ void sqlite3FinishCoding(Parse *pParse){ /* Get the VDBE program ready for execution */ - if( v && pParse->nErr==0 && !db->mallocFailed ){ + if( v && ALWAYS(pParse->nErr==0) && !db->mallocFailed ){ #ifdef SQLITE_DEBUG FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0; sqlite3VdbeTrace(v, trace); @@ -327,11 +323,9 @@ Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){ for(i=OMIT_TEMPDB; inDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ Schema *pSchema = db->aDb[j].pSchema; + assert( pSchema ); if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue; - assert( pSchema || (j==1 && !db->aDb[1].pBt) ); - if( pSchema ){ - p = sqlite3HashFind(&pSchema->idxHash, zName, nName); - } + p = sqlite3HashFind(&pSchema->idxHash, zName, nName); if( p ) break; } return p; @@ -378,13 +372,19 @@ void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){ len = sqlite3Strlen30(zIdxName); pIndex = sqlite3HashInsert(pHash, zIdxName, len, 0); - if( pIndex ){ + /* Justification of ALWAYS(): This routine is only called from the + ** OP_DropIndex opcode. And there is no way that opcode will ever run + ** unless the corresponding index is in the symbol table. */ + if( ALWAYS(pIndex) ){ if( pIndex->pTable->pIndex==pIndex ){ pIndex->pTable->pIndex = pIndex->pNext; }else{ Index *p; - for(p=pIndex->pTable->pIndex; p && p->pNext!=pIndex; p=p->pNext){} - if( p && p->pNext==pIndex ){ + /* Justification of ALWAYS(); The index must be on the list of + ** indices. */ + p = pIndex->pTable->pIndex; + while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; } + if( ALWAYS(p && p->pNext==pIndex) ){ p->pNext = pIndex->pNext; } } @@ -429,13 +429,6 @@ void sqlite3ResetInternalSchema(sqlite3 *db, int iDb){ ** schema hash tables and therefore do not have to make any changes ** to any of those tables. */ - for(i=0; inDb; i++){ - struct Db *pDb = &db->aDb[i]; - if( pDb->pBt==0 ){ - if( pDb->pAux && pDb->xFreeAux ) pDb->xFreeAux(pDb->pAux); - pDb->pAux = 0; - } - } for(i=j=2; inDb; i++){ struct Db *pDb = &db->aDb[i]; if( pDb->pBt==0 ){ @@ -1452,7 +1445,7 @@ void sqlite3EndTable( sqlite3 *db = pParse->db; int iDb; - if( (pEnd==0 && pSelect==0) || pParse->nErr || db->mallocFailed ) { + if( (pEnd==0 && pSelect==0) || NEVER(pParse->nErr) || db->mallocFailed ) { return; } p = pParse->pNewTable; @@ -1969,7 +1962,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ sqlite3 *db = pParse->db; int iDb; - if( pParse->nErr || db->mallocFailed ){ + if( NEVER(pParse->nErr) || db->mallocFailed ){ goto exit_drop_table; } assert( pName->nSrc==1 ); @@ -2617,7 +2610,7 @@ void sqlite3CreateIndex( zColl = db->pDfltColl->zName; } } - if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){ + if( NEVER(!db->init.busy && !sqlite3LocateCollSeq(pParse, zColl)) ){ goto exit_create_index; } pIndex->azColl[i] = zColl; @@ -3283,7 +3276,7 @@ void sqlite3BeginTransaction(Parse *pParse, int type){ assert( pParse!=0 ); db = pParse->db; assert( db!=0 ); - if( db->aDb[0].pBt==0 ) return; +/* if( db->aDb[0].pBt==0 ) return; */ if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ){ return; } @@ -3308,7 +3301,7 @@ void sqlite3CommitTransaction(Parse *pParse){ assert( pParse!=0 ); db = pParse->db; assert( db!=0 ); - if( db->aDb[0].pBt==0 ) return; +/* if( db->aDb[0].pBt==0 ) return; */ if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ){ return; } @@ -3328,7 +3321,7 @@ void sqlite3RollbackTransaction(Parse *pParse){ assert( pParse!=0 ); db = pParse->db; assert( db!=0 ); - if( db->aDb[0].pBt==0 ) return; +/* if( db->aDb[0].pBt==0 ) return; */ if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ){ return; } @@ -3467,9 +3460,11 @@ void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){ #ifndef SQLITE_OMIT_REINDEX static int collationMatch(const char *zColl, Index *pIndex){ int i; + assert( zColl!=0 ); for(i=0; inColumn; i++){ const char *z = pIndex->azColl[i]; - if( z==zColl || (z && zColl && 0==sqlite3StrICmp(z, zColl)) ){ + assert( z!=0 ); + if( 0==sqlite3StrICmp(z, zColl) ){ return 1; } } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index fccccb656f..ceba6b0737 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.870 2009/05/11 20:53:29 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.871 2009/05/13 17:21:14 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -618,8 +618,6 @@ struct Db { Btree *pBt; /* The B*Tree structure for this database file */ u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */ u8 safety_level; /* How aggressive at syncing data to disk */ - void *pAux; /* Auxiliary data. Usually NULL */ - void (*xFreeAux)(void*); /* Routine to free pAux */ Schema *pSchema; /* Pointer to database schema (possibly shared) */ };