Additional simplifications to build.c in support full coverage testing. (CVS 6636)

FossilOrigin-Name: 913d11149396d3dc797f1efeb4f7e60865483399
This commit is contained in:
drh 2009-05-13 22:58:28 +00:00
parent b7f24de283
commit 8af73d4154
3 changed files with 34 additions and 28 deletions

View File

@ -1,5 +1,5 @@
C Remove\sincorrect\sNEVER()\smacro\sin\sthe\sprevious\scheck-in\s(6634).\s(CVS\s6635)
D 2009-05-13T17:35:23
C Additional\ssimplifications\sto\sbuild.c\sin\ssupport\sfull\scoverage\stesting.\s(CVS\s6636)
D 2009-05-13T22:58:29
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 6cf99a4e3235b5da7655281651a9f1076d6ae0e4
F src/build.c 2b4cef0dccea8d5ceb34d30b69121590ad2d5314
F src/callback.c bf295cfdc065b56cc49a5f6452126dc4ffe0ff5b
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
@ -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 264ace50bbaec3468de0e42b2b8cebf9ce1d6682
R 843d02846a4c9c1e2f03264992adfe69
P c684957991fe45cbcb188d2a419501c3f1fdc93f
R b7d938cf0534e6a7525437136b322f35
U drh
Z 89e04f4f589e3ad4c80a45972c432ebb
Z a945f0494911586b285a588e892ed85a

View File

@ -1 +1 @@
c684957991fe45cbcb188d2a419501c3f1fdc93f
913d11149396d3dc797f1efeb4f7e60865483399

View File

@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.543 2009/05/13 17:35:23 drh Exp $
** $Id: build.c,v 1.544 2009/05/13 22:58:29 drh Exp $
*/
#include "sqliteInt.h"
@ -68,7 +68,7 @@ void sqlite3TableLock(
int nBytes;
TableLock *p;
if( NEVER(iDb<0) ) return;
assert( iDb>=0 );
for(i=0; i<pParse->nTableLock; i++){
p = &pParse->aTableLock[i];
if( p->iDb==iDb && p->iTab==iTab ){
@ -336,7 +336,7 @@ Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){
*/
static void freeIndex(Index *p){
sqlite3 *db = p->pTable->dbMem;
testcase( db==0 );
/* testcase( db==0 ); */
sqlite3DbFree(db, p->zColAff);
sqlite3DbFree(db, p);
}
@ -1445,7 +1445,7 @@ void sqlite3EndTable(
sqlite3 *db = pParse->db;
int iDb;
if( (pEnd==0 && pSelect==0) || NEVER(pParse->nErr) || db->mallocFailed ) {
if( (pEnd==0 && pSelect==0) || db->mallocFailed ){
return;
}
p = pParse->pNewTable;
@ -1608,7 +1608,7 @@ void sqlite3EndTable(
/* Add the table to the in-memory representation of the database.
*/
if( db->init.busy && ALWAYS(pParse->nErr==0) ){
if( db->init.busy ){
Table *pOld;
Schema *pSchema = p->pSchema;
pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName,
@ -1666,10 +1666,12 @@ void sqlite3CreateView(
}
sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr);
p = pParse->pNewTable;
if( p==0 || NEVER(pParse->nErr>0) ){
if( p==0 ){
sqlite3SelectDelete(db, pSelect);
return;
}
assert( pParse->nErr==0 ); /* If sqlite3StartTable return non-NULL then
** there could not have been an error */
sqlite3TwoPartName(pParse, pName1, pName2, &pName);
iDb = sqlite3SchemaToIndex(db, p->pSchema);
if( sqlite3FixInit(&sFix, pParse, iDb, "view", pName)
@ -1962,9 +1964,10 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){
sqlite3 *db = pParse->db;
int iDb;
if( NEVER(pParse->nErr) || db->mallocFailed ){
if( db->mallocFailed ){
goto exit_drop_table;
}
assert( pParse->nErr==0 );
assert( pName->nSrc==1 );
pTab = sqlite3LocateTable(pParse, isView,
pName->a[0].zName, pName->a[0].zDatabase);
@ -2149,7 +2152,7 @@ void sqlite3CreateForeignKey(
char *z;
assert( pTo!=0 );
if( p==0 || NEVER(pParse->nErr) || IN_DECLARE_VTAB ) goto fk_end;
if( p==0 || IN_DECLARE_VTAB ) goto fk_end;
if( pFromCol==0 ){
int iCol = p->nCol-1;
if( NEVER(iCol<0) ) goto fk_end;
@ -2370,7 +2373,8 @@ void sqlite3CreateIndex(
char *zExtra;
assert( pStart==0 || pEnd!=0 ); /* pEnd must be non-NULL if pStart is */
if( NEVER(pParse->nErr>0) || db->mallocFailed || IN_DECLARE_VTAB ){
assert( pParse->nErr==0 ); /* Never called with prior errors */
if( db->mallocFailed || IN_DECLARE_VTAB ){
goto exit_create_index;
}
if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
@ -2846,7 +2850,8 @@ void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){
sqlite3 *db = pParse->db;
int iDb;
if( NEVER(pParse->nErr>0) || db->mallocFailed ){
assert( pParse->nErr==0 ); /* Never called with prior errors */
if( db->mallocFailed ){
goto exit_drop_index;
}
assert( pName->nSrc==1 );
@ -3037,10 +3042,8 @@ SrcList *sqlite3SrcListEnlarge(
/* Sanity checking on calling parameters */
assert( iStart>=0 );
assert( nExtra>=1 );
if( pSrc==0 || iStart>pSrc->nSrc ){
assert( db->mallocFailed );
return pSrc;
}
assert( pSrc!=0 );
assert( iStart<=pSrc->nSrc );
/* Allocate additional space if needed */
if( pSrc->nSrc+nExtra>pSrc->nAlloc ){
@ -3206,14 +3209,15 @@ SrcList *sqlite3SrcListAppendFromTerm(
struct SrcList_item *pItem;
sqlite3 *db = pParse->db;
p = sqlite3SrcListAppend(db, p, pTable, pDatabase);
if( p==0 || p->nSrc==0 ){
if( p==0 || NEVER(p->nSrc==0) ){
sqlite3ExprDelete(db, pOn);
sqlite3IdListDelete(db, pUsing);
sqlite3SelectDelete(db, pSubquery);
return p;
}
pItem = &p->a[p->nSrc-1];
if( pAlias && pAlias->n ){
assert( pAlias!=0 );
if( pAlias->n ){
pItem->zAlias = sqlite3NameFromToken(db, pAlias);
}
pItem->pSelect = pSubquery;
@ -3227,7 +3231,8 @@ SrcList *sqlite3SrcListAppendFromTerm(
** element of the source-list passed as the second argument.
*/
void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){
if( pIndexedBy && p && p->nSrc>0 ){
assert( pIndexedBy!=0 );
if( p && ALWAYS(p->nSrc>0) ){
struct SrcList_item *pItem = &p->a[p->nSrc-1];
assert( pItem->notIndexed==0 && pItem->zIndex==0 );
if( pIndexedBy->n==1 && !pIndexedBy->z ){
@ -3444,12 +3449,13 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
** necessary to undo a write and the checkpoint should not be set.
*/
void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){
Vdbe *v = sqlite3GetVdbe(pParse);
if( v==0 ) return;
sqlite3CodeVerifySchema(pParse, iDb);
pParse->writeMask |= 1<<iDb;
if( setStatement && pParse->nested==0 ){
sqlite3VdbeAddOp1(v, OP_Statement, iDb);
/* Every place where this routine is called with setStatement!=0 has
** already successfully created a VDBE. */
assert( pParse->pVdbe );
sqlite3VdbeAddOp1(pParse->pVdbe, OP_Statement, iDb);
}
}
@ -3543,7 +3549,7 @@ void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){
return;
}
if( pName1==0 || NEVER(pName1->z==0) ){
if( pName1==0 ){
reindexDatabases(pParse, 0);
return;
}else if( NEVER(pName2==0) || pName2->z==0 ){