aboutsummaryrefslogtreecommitdiff
path: root/src/btree.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-12-09 16:02:00 +0000
committerdrh <drh@noemail.net>2016-12-09 16:02:00 +0000
commita2ee589c468b0b8b6cf9682dae652c9068c825f6 (patch)
tree91d6b0e93ace25fc9e082fb7e8de5ed93ed46a94 /src/btree.c
parente0568d6fb8d5b9b68dff1307577e8e194edb6501 (diff)
downloadsqlite-a2ee589c468b0b8b6cf9682dae652c9068c825f6.tar.gz
sqlite-a2ee589c468b0b8b6cf9682dae652c9068c825f6.zip
Avoid unnecessary zeroing of fields in the MemPage object that are going
to be reinitialized before use anyhow. A smaller and faster binary results. FossilOrigin-Name: 01ada3d1068476f90dcae02cb089001ea4bcc23d
Diffstat (limited to 'src/btree.c')
-rw-r--r--src/btree.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/btree.c b/src/btree.c
index 7a68331c3..999ce159c 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -2282,7 +2282,7 @@ int sqlite3BtreeOpen(
goto btree_open_out;
}
rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
- EXTRA_SIZE, flags, vfsFlags, pageReinit);
+ sizeof(MemPage), flags, vfsFlags, pageReinit);
if( rc==SQLITE_OK ){
sqlite3PagerSetMmapLimit(pBt->pPager, db->szMmap);
rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);
@@ -6259,7 +6259,6 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
if( *pRC ) return;
-
assert( idx>=0 && idx<pPage->nCell );
assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
@@ -6343,7 +6342,10 @@ static void insertCell(
put4byte(pCell, iChild);
}
j = pPage->nOverflow++;
- assert( j<(int)(sizeof(pPage->apOvfl)/sizeof(pPage->apOvfl[0])) );
+ /* Comparison against ArraySize-1 since we hold back one extra slot
+ ** as a contingency. In other words, never need more than 3 overflow
+ ** slots but 4 are allocated, just to be safe. */
+ assert( j < ArraySize(pPage->apOvfl)-1 );
pPage->apOvfl[j] = pCell;
pPage->aiOvfl[j] = (u16)i;