Additional simplifications to btree.c in support of coverage testing. (CVS 6915)

FossilOrigin-Name: 716fccea58c4c217e68e04e0776e44ae39c11950
This commit is contained in:
drh 2009-07-21 19:02:20 +00:00
parent fd5f02f0c6
commit fe3313f9b1
3 changed files with 22 additions and 18 deletions

View File

@ -1,5 +1,5 @@
C Remove\san\sassert()\sin\sbtree.c\swhich\sis\sno\slonger\strue\sdue\sto\schanges\sin\nthe\serror\sreporting\sbehavior\sof\sptrmapPut().\s(CVS\s6914)
D 2009-07-21T15:33:14
C Additional\ssimplifications\sto\sbtree.c\sin\ssupport\sof\scoverage\stesting.\s(CVS\s6915)
D 2009-07-21T19:02:21
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c cfbf6af5b0ababb4f06ed3e75c616dadaf47fcbd
F src/btmutex.c 0f43a75bb5b8147b386e8e1c3e71ba734e3863b7
F src/btree.c d5f5b30e99c76313be8c536ddfe23ef8f977dce1
F src/btree.c abc2ccac9f9cf605888b48689e5886301c0f25c0
F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705
F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@ -741,7 +741,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 4cf23e9e860bd6245344884ec84f487fdf36f86f
R 4d981fb2e48132ca3248308bdb7b71d3
P 110998f18a7ad1ddaffab048cabef675d882cbb8
R c2ae620b83a5c070a034b2845bc5bdf6
U drh
Z 96adb5cc46ca1f3f04bd2c13acf12fa5
Z 3dae4d3e2687351a2da40f1b63712770

View File

@ -1 +1 @@
110998f18a7ad1ddaffab048cabef675d882cbb8
716fccea58c4c217e68e04e0776e44ae39c11950

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.695 2009/07/21 15:33:14 drh Exp $
** $Id: btree.c,v 1.696 2009/07/21 19:02:21 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@ -3857,7 +3857,10 @@ static const unsigned char *fetchPayload(
assert( cursorHoldsMutex(pCur) );
pPage = pCur->apPage[pCur->iPage];
assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );
getCellInfo(pCur);
if( NEVER(pCur->info.nSize==0) ){
btreeParseCell(pCur->apPage[pCur->iPage], pCur->aiIdx[pCur->iPage],
&pCur->info);
}
aPayload = pCur->info.pCell;
aPayload += pCur->info.nHeader;
if( pPage->intKey ){
@ -3870,9 +3873,7 @@ static const unsigned char *fetchPayload(
nLocal = pCur->info.nLocal - nKey;
}else{
nLocal = pCur->info.nLocal;
if( nLocal>nKey ){
nLocal = nKey;
}
assert( nLocal<=nKey );
}
*pAmt = nLocal;
return aPayload;
@ -3894,20 +3895,22 @@ static const unsigned char *fetchPayload(
** in the common case where no overflow pages are used.
*/
const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){
const void *p = 0;
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
assert( cursorHoldsMutex(pCur) );
if( pCur->eState==CURSOR_VALID ){
return (const void*)fetchPayload(pCur, pAmt, 0);
if( ALWAYS(pCur->eState==CURSOR_VALID) ){
p = (const void*)fetchPayload(pCur, pAmt, 0);
}
return 0;
return p;
}
const void *sqlite3BtreeDataFetch(BtCursor *pCur, int *pAmt){
const void *p = 0;
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
assert( cursorHoldsMutex(pCur) );
if( pCur->eState==CURSOR_VALID ){
return (const void*)fetchPayload(pCur, pAmt, 1);
if( ALWAYS(pCur->eState==CURSOR_VALID) ){
p = (const void*)fetchPayload(pCur, pAmt, 1);
}
return 0;
return p;
}
@ -6981,6 +6984,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
if( rc!=SQLITE_OK ){
return rc;
}
pMove = 0;
rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0);
freePage(pMove, &rc);
releasePage(pMove);