1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-19 21:43:15 +03:00

Fix some minor formatting and code organization issues.

FossilOrigin-Name: eab8706dc47aa0a44caf73619de858397c3e0b4e
This commit is contained in:
dan
2014-10-24 16:40:49 +00:00
parent cc8490d2cd
commit e6593d8e8c
5 changed files with 28 additions and 23 deletions

View File

@@ -1233,7 +1233,7 @@ static int defragmentPage(MemPage *pPage){
**
** This function may detect corruption within pPg. If it does and argument
** pRc is non-NULL, then *pRc is set to SQLITE_CORRUPT and NULL is returned.
** Or, if corruption is detected by pRc is NULL, NULL is returned and the
** Or, if corruption is detected and pRc is NULL, NULL is returned and the
** corruption goes unreported.
*/
static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
@@ -6345,7 +6345,7 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){
}
#endif /* SQLITE_OMIT_QUICKBALANCE */
#if 1
#if 0
/*
** This function does not contribute anything to the operation of SQLite.
** it is sometimes activated temporarily while debugging code responsible
@@ -6522,10 +6522,9 @@ static int balance_nonroot(
u16 *szCell; /* Local size of all cells in apCell[] */
u8 *aSpace1; /* Space for copies of dividers cells */
Pgno pgno; /* Temp var to store a page number in */
u8 abDone[NB+2];
Pgno aPgno[NB+2];
u16 aPgFlags[NB+2];
u8 abDone[NB+2]; /* True after i'th new page is populated */
Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
u16 aPgFlags[NB+2]; /* flags field of new pages before shuffling */
memset(abDone, 0, sizeof(abDone));
pBt = pParent->pBt;
@@ -6868,8 +6867,7 @@ static int balance_nonroot(
}
}
if( apNew[i]->pgno!=iMin ){
apNew[i]->pDbPage->flags = flags;
sqlite3PagerRekey(apNew[i]->pDbPage, iMin);
sqlite3PagerRekey(apNew[i]->pDbPage, iMin, flags);
apNew[i]->pgno = iMin;
}
}
@@ -7090,7 +7088,7 @@ static int balance_nonroot(
freePage(apOld[i], &rc);
}
#if 1
#if 0
if( ISAUTOVACUUM && rc==SQLITE_OK && apNew[0]->isInit ){
/* The ptrmapCheckPages() contains assert() statements that verify that
** all pointer map pages are set correctly. This is helpful while

View File

@@ -6845,16 +6845,23 @@ int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
return SQLITE_OK;
}
#endif
void sqlite3PagerRekey(DbPage *pPage, Pgno iNew){
/*
** The page handle passed as the first argument refers to a dirty page
** with a page number other than iNew. This function changes the page's
** page number to iNew and sets the value of the PgHdr.flags field to
** the value passed as the third parameter.
*/
void sqlite3PagerRekey(DbPage *pPage, Pgno iNew, u16 flags){
PgHdr *pPg = (PgHdr*)pPage;
assert( pPg->flags & PGHDR_DIRTY );
assert( (flags & PGHDR_DIRTY) && (pPg->flags & PGHDR_DIRTY) );
assert( !subjRequiresPage(pPg) );
assert( pPg->pgno!=iNew );
pPg->flags = flags;
sqlite3PcacheMove(pPg, iNew);
}
#endif
/*
** Return a pointer to the data for the specified page.
*/

View File

@@ -188,7 +188,7 @@ int sqlite3SectorSize(sqlite3_file *);
/* Functions used to truncate the database file. */
void sqlite3PagerTruncateImage(Pager*,Pgno);
void sqlite3PagerRekey(DbPage*, Pgno);
void sqlite3PagerRekey(DbPage*, Pgno, u16);
#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)
void *sqlite3PagerCodec(DbPage *);