aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2022-03-21 18:48:31 +0000
committerdrh <>2022-03-21 18:48:31 +0000
commitc63e40956b346035aca581378572dbbf7834c3ab (patch)
tree6093720177a88b9ae12cb5207efab0b67fb826d5 /src
parentbd5fb3a88814c06f52562e7678210566207bc9b3 (diff)
downloadsqlite-c63e40956b346035aca581378572dbbf7834c3ab.tar.gz
sqlite-c63e40956b346035aca581378572dbbf7834c3ab.zip
Some branches are no longer reachable after the previous change. Mark them
accordingly. Also improve comments. FossilOrigin-Name: 88d69f60cceb22bde42cfe43c23259c7bad47b8e06f918a79bd089a77b480d46
Diffstat (limited to 'src')
-rw-r--r--src/btree.c8
-rw-r--r--src/pcache.c3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/btree.c b/src/btree.c
index 5b84604f5..41087825b 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -9031,7 +9031,12 @@ int sqlite3BtreeInsert(
}
}
+ /* Ensure that the cursor is not in the CURSOR_FAULT state and that it
+ ** points to a valid cell.
+ */
if( pCur->eState>=CURSOR_REQUIRESEEK ){
+ testcase( pCur->eState==CURSOR_REQUIRESEEK );
+ testcase( pCur->eState==CURSOR_FAULT );
rc = moveToRoot(pCur);
if( rc && rc!=SQLITE_EMPTY ) return rc;
}
@@ -9143,7 +9148,8 @@ int sqlite3BtreeInsert(
assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
assert( pPage->leaf || !pPage->intKey );
if( pPage->nFree<0 ){
- if( pCur->eState>CURSOR_INVALID ){
+ if( NEVER(pCur->eState>CURSOR_INVALID) ){
+ /* ^^^^^--- due to the moveToRoot() call above */
rc = SQLITE_CORRUPT_BKPT;
}else{
rc = btreeComputeFreeSpace(pPage);
diff --git a/src/pcache.c b/src/pcache.c
index 76cc4bb7a..14d1e7cde 100644
--- a/src/pcache.c
+++ b/src/pcache.c
@@ -551,8 +551,7 @@ void sqlite3PcacheDrop(PgHdr *p){
** make it so.
*/
void sqlite3PcacheMakeDirty(PgHdr *p){
- assert( p->nRef>0 || p->pCache->bPurgeable==0 );
- testcase( p->nRef==0 );
+ assert( p->nRef>0 );
assert( sqlite3PcachePageSanity(p) );
if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){ /*OPTIMIZATION-IF-FALSE*/
p->flags &= ~PGHDR_DONT_WRITE;