1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Small performance optimization in the freeSpace() routine of btree.c.

FossilOrigin-Name: 63962e2a927963575be74c3ce11f39f722c07c72
This commit is contained in:
drh
2016-09-17 19:34:32 +00:00
parent fd7459e0aa
commit 85f071b850
3 changed files with 12 additions and 9 deletions

View File

@@ -1605,8 +1605,11 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
if( data[iPtr+1]==0 && data[iPtr]==0 ){
iFreeBlk = 0; /* Shortcut for the case when the freelist is empty */
}else{
while( (iFreeBlk = get2byte(&data[iPtr]))>0 && iFreeBlk<iStart ){
if( iFreeBlk<iPtr+4 ) return SQLITE_CORRUPT_BKPT;
while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
if( iFreeBlk<iPtr+4 ){
if( iFreeBlk==0 ) break;
return SQLITE_CORRUPT_BKPT;
}
iPtr = iFreeBlk;
}
if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT;