From: drh Date: Tue, 12 May 2009 00:40:12 +0000 (+0000) Subject: Tweaks to build.c to facilitate coverage testing. (CVS 6628) X-Git-Tag: version-3.6.15~122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=768578ee2a7653661ddc2b0b4d0b0649fc744228;p=thirdparty%2Fsqlite.git Tweaks to build.c to facilitate coverage testing. (CVS 6628) FossilOrigin-Name: 6572b438a02cc44546174e132dfbdc1d141cd451 --- diff --git a/manifest b/manifest index fc18b65ae8..f74b575063 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C If\sa\svirtual\stable\sconstructor\sreturns\sSQLITE_NOMEM,\sset\sthe\smallocFailed\nflag\sin\sthe\scorresponding\sdatabase\sconnection\sto\sinsure\sthat\sthe\serror\nis\spropagated\sback\sto\sthe\stop\slayer.\s(CVS\s6627) -D 2009-05-11T23:38:00 +C Tweaks\sto\sbuild.c\sto\sfacilitate\scoverage\stesting.\s(CVS\s6628) +D 2009-05-12T00:40:13 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 caece8163ad2cf6be278ad5405f25852c468d8d8 +F src/build.c 65caba758665cc1f511864329940aac19344e2db 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 33cf83591e6e13875ef6ada5b8ac8ab07619d8bc -R 1e077e3ba746ae1ba5340b2bc353df44 +P 5635666f20358e854a76d244768198734afd4299 +R f9f1009ab66a2d75fd919e71db434f55 U drh -Z bd311d11dec0024101d1628d00e7c29b +Z 612bf8c819ce488d831d79c1e2187441 diff --git a/manifest.uuid b/manifest.uuid index 0c721a2b95..dd0c4bcca3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5635666f20358e854a76d244768198734afd4299 \ No newline at end of file +6572b438a02cc44546174e132dfbdc1d141cd451 \ No newline at end of file diff --git a/src/build.c b/src/build.c index ecf16141db..d1e3dfe5ed 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.538 2009/05/11 20:53:29 drh Exp $ +** $Id: build.c,v 1.539 2009/05/12 00:40:13 drh Exp $ */ #include "sqliteInt.h" @@ -1508,7 +1508,7 @@ void sqlite3EndTable( char *zStmt; /* Text of the CREATE TABLE or CREATE VIEW statement */ v = sqlite3GetVdbe(pParse); - if( v==0 ) return; + if( NEVER(v==0) ) return; sqlite3VdbeAddOp1(v, OP_Close, 0); @@ -1615,7 +1615,7 @@ void sqlite3EndTable( /* Add the table to the in-memory representation of the database. */ - if( db->init.busy && pParse->nErr==0 ){ + if( db->init.busy && ALWAYS(pParse->nErr==0) ){ Table *pOld; Schema *pSchema = p->pSchema; pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, @@ -1673,7 +1673,7 @@ void sqlite3CreateView( } sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr); p = pParse->pNewTable; - if( p==0 || pParse->nErr ){ + if( p==0 || NEVER(pParse->nErr>0) ){ sqlite3SelectDelete(db, pSelect); return; } @@ -1704,13 +1704,13 @@ void sqlite3CreateView( ** the end. */ sEnd = pParse->sLastToken; - if( sEnd.z[0]!=0 && sEnd.z[0]!=';' ){ + if( ALWAYS(sEnd.z[0]!=0) && sEnd.z[0]!=';' ){ sEnd.z += sEnd.n; } sEnd.n = 0; n = (int)(sEnd.z - pBegin->z); z = (const unsigned char*)pBegin->z; - while( n>0 && (z[n-1]==';' || sqlite3Isspace(z[n-1])) ){ n--; } + while( ALWAYS(n>0) && sqlite3Isspace(z[n-1]) ){ n--; } sEnd.z = &z[n-1]; sEnd.n = 1; @@ -1756,8 +1756,13 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ ** CREATE VIEW one AS SELECT * FROM two; ** CREATE VIEW two AS SELECT * FROM one; ** - ** Actually, this error is caught previously and so the following test - ** should always fail. But we will leave it in place just to be safe. + ** Actually, the error above is now caught prior to reaching this point. + ** But the following test is still important as it does come up + ** in the following: + ** + ** CREATE TABLE main.ex1(a); + ** CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; + ** SELECT * FROM temp.ex1; */ if( pTable->nCol<0 ){ sqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName); @@ -2051,9 +2056,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ - if( v ){ - sqlite3VdbeAddOp0(v, OP_VBegin); - } + sqlite3VdbeAddOp0(v, OP_VBegin); } #endif