]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Testability improvement. btree-opt2
authordrh <drh@noemail.net>
Tue, 23 Jun 2015 21:35:28 +0000 (21:35 +0000)
committerdrh <drh@noemail.net>
Tue, 23 Jun 2015 21:35:28 +0000 (21:35 +0000)
FossilOrigin-Name: eed6a3314518cdab809264284d7680385f0d5d2a

manifest
manifest.uuid
src/btree.c

index aa8d0d2d8766f196d827ab7b16a44a64f0409ad9..718b155db27d661e0e3639b5950f5bf6ed57e277 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Multiple\soverflow\scells\sare\salways\sadjacent\sand\ssequential.\s\sExploit\sthis\ninvariant\sfor\sa\ssmall\ssize\sreduction\sand\sperformance\sincrease\sand\sadd\nassert()s\sto\sprove\sthe\sinvariant.
-D 2015-06-23T18:24:25.456
+C Testability\simprovement.
+D 2015-06-23T21:35:28.724
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -192,7 +192,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
 F src/backup.c ff743689c4d6c5cb55ad42ed9d174b2b3e71f1e3
 F src/bitvec.c 5eb7958c3bf65210211cbcfc44eff86d0ded7c9d
 F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
-F src/btree.c ca394997680c8068a3ef87fd8ad55b1a7dad08a4
+F src/btree.c 587dd00c675e99d61614c9537feb73bfc2e9683d
 F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
 F src/btreeInt.h 6ece2dd9c8e2eac05f0a8ded8772a44e96486c65
 F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70
@@ -1286,7 +1286,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P fda89b0512477f9da09fd0f4e548ed4b13efd49d
-R 8408184ce1eeef4fb81f9e80cd68a3ff
+P f77f2f48f48e374a72b6c054142f7a3ec0b1483c
+R 4d132507809128fd95303043fe3c27fc
 U drh
-Z f70e49c696aab72ebd6898ae9c8ebc72
+Z 2d888246a6aeb99138896a0f8b9aa3e8
index 8e86c416dad5920fb96d29ece7e624602983de77..62fd6afdb31878e2e7bb4815f5883dab3729da49 100644 (file)
@@ -1 +1 @@
-f77f2f48f48e374a72b6c054142f7a3ec0b1483c
\ No newline at end of file
+eed6a3314518cdab809264284d7680385f0d5d2a
\ No newline at end of file
index d867a661a8e31bc8de1120751a7a5c53635dd6c6..77d9833f91ee131be87ce0d89b8d5b7ab9af72c3 100644 (file)
@@ -1553,7 +1553,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
       nFrag = iFreeBlk - iEnd;
       if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_BKPT;
       iEnd = iFreeBlk + get2byte(&data[iFreeBlk+2]);
-      if( iEnd > pPage->pBt->usableSize ) return SQLITE_CORRUPT_BKPT;
+      if( NEVER(iEnd > pPage->pBt->usableSize) ) return SQLITE_CORRUPT_BKPT;
       iSize = iEnd - iStart;
       iFreeBlk = get2byte(&data[iFreeBlk]);
     }
@@ -3184,7 +3184,6 @@ static int setChildPtrmaps(MemPage *pPage){
     if( !pPage->leaf ){
       Pgno childPgno = get4byte(pCell);
       ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
-      if( rc ) return rc;
     }
   }
 
@@ -6358,7 +6357,7 @@ static int rebuildPage(
     if( pData < pCellptr ) return SQLITE_CORRUPT_BKPT;
     memcpy(pData, pCell, szCell[i]);
     assert( szCell[i]==pPg->xCellSize(pPg, pCell) || CORRUPT_DB );
-    testcase( szCell[i]==pPg->xCellSize(pPg,pCell) );
+    testcase( szCell[i]!=pPg->xCellSize(pPg,pCell) );
   }
 
   /* The pPg->nFree field is now set incorrectly. The caller will fix it. */
@@ -6659,7 +6658,7 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){
     assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
     zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);
     rc = rebuildPage(pNew, 1, &pCell, &szCell);
-    if( rc ) return rc;
+    if( NEVER(rc) ) return rc;
     pNew->nFree = pBt->usableSize - pNew->cellOffset - 2 - szCell;
 
     /* If this is an auto-vacuum database, update the pointer map
@@ -7404,12 +7403,11 @@ static int balance_nonroot(
       ){
         if( !leafCorrection ){
           ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
-          if( rc ) goto balance_cleanup;
         }
         if( cachedCellSize(&b,i)>pNew->minLocal ){
           ptrmapPutOvflPtr(pNew, pCell, &rc);
-          if( rc ) goto balance_cleanup;
         }
+        if( rc ) goto balance_cleanup;
       }
     }
   }
@@ -8043,7 +8041,7 @@ int sqlite3BtreeDelete(BtCursor *pCur){
     unsigned char *pTmp;
 
     pCell = findCell(pLeaf, pLeaf->nCell-1);
-    if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT;
+    if( NEVER(pCell<&pLeaf->aData[4]) ) return SQLITE_CORRUPT_BKPT;
     nCell = pLeaf->xCellSize(pLeaf, pCell);
     assert( MX_CELL_SIZE(pBt) >= nCell );
     pTmp = pBt->pTmpSpace;