aboutsummaryrefslogtreecommitdiff
path: root/src/btree.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-02-06 22:32:06 +0000
committerdrh <drh@noemail.net>2016-02-06 22:32:06 +0000
commitcc5f8a46b975d5afb86bfbe2da2ee7f2d85d7572 (patch)
tree2f4f298a726bba28cc67d528a596b24c2adda3e5 /src/btree.c
parentf5818aa560fc463e241bbeeaefba8cfacdd0131f (diff)
downloadsqlite-cc5f8a46b975d5afb86bfbe2da2ee7f2d85d7572.tar.gz
sqlite-cc5f8a46b975d5afb86bfbe2da2ee7f2d85d7572.zip
Add a utility program that looks for assert(), NEVER(), ALWAYS(), and
testcase() macros that have side-effects, and reports errors when they are found. Also fix a bug that this utility detected as it was being tested. FossilOrigin-Name: b0b4624fc5d53bb0cc9fae7dad51984837d946ac
Diffstat (limited to 'src/btree.c')
-rw-r--r--src/btree.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/btree.c b/src/btree.c
index b99820ddb..c6f9c34f7 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -6148,7 +6148,7 @@ static int fillInCell(
{
CellInfo info;
pPage->xParseCell(pPage, pCell, &info);
- assert( nHeader=(int)(info.pPayload - pCell) );
+ assert( nHeader==(int)(info.pPayload - pCell) );
assert( info.nKey==nKey );
assert( *pnSize == info.nSize );
assert( spaceLeft == info.nLocal );
@@ -7807,8 +7807,8 @@ static int balance(BtCursor *pCur){
u8 aBalanceQuickSpace[13];
u8 *pFree = 0;
- TESTONLY( int balance_quick_called = 0 );
- TESTONLY( int balance_deeper_called = 0 );
+ VVA_ONLY( int balance_quick_called = 0 );
+ VVA_ONLY( int balance_deeper_called = 0 );
do {
int iPage = pCur->iPage;
@@ -7821,7 +7821,8 @@ static int balance(BtCursor *pCur){
** and copy the current contents of the root-page to it. The
** next iteration of the do-loop will balance the child page.
*/
- assert( (balance_deeper_called++)==0 );
+ assert( balance_deeper_called==0 );
+ VVA_ONLY( balance_deeper_called++ );
rc = balance_deeper(pPage, &pCur->apPage[1]);
if( rc==SQLITE_OK ){
pCur->iPage = 1;
@@ -7860,7 +7861,8 @@ static int balance(BtCursor *pCur){
** function. If this were not verified, a subtle bug involving reuse
** of the aBalanceQuickSpace[] might sneak in.
*/
- assert( (balance_quick_called++)==0 );
+ assert( balance_quick_called==0 );
+ VVA_ONLY( balance_quick_called++ );
rc = balance_quick(pParent, pPage, aBalanceQuickSpace);
}else
#endif
@@ -9327,7 +9329,8 @@ char *sqlite3BtreeIntegrityCheck(
sqlite3BtreeEnter(p);
assert( p->inTrans>TRANS_NONE && pBt->inTransaction>TRANS_NONE );
- assert( (nRef = sqlite3PagerRefcount(pBt->pPager))>=0 );
+ VVA_ONLY( nRef = sqlite3PagerRefcount(pBt->pPager) );
+ assert( nRef>=0 );
sCheck.pBt = pBt;
sCheck.pPager = pBt->pPager;
sCheck.nPage = btreePagecount(sCheck.pBt);