mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
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
This commit is contained in:
@@ -284,6 +284,12 @@ int sqlite3PcacheSize(void){ return sizeof(PCache); }
|
||||
** has already been allocated and is passed in as the p pointer.
|
||||
** The caller discovers how much space needs to be allocated by
|
||||
** calling sqlite3PcacheSize().
|
||||
**
|
||||
** szExtra is some extra space allocated for each page. The first
|
||||
** 8 bytes of the extra space will be zeroed as the page is allocated,
|
||||
** but remaining content will be uninitialized. Though it is opaque
|
||||
** to this module, the extra space really ends up being the MemPage
|
||||
** structure in the pager.
|
||||
*/
|
||||
int sqlite3PcacheOpen(
|
||||
int szPage, /* Size of every page */
|
||||
@@ -296,6 +302,7 @@ int sqlite3PcacheOpen(
|
||||
memset(p, 0, sizeof(PCache));
|
||||
p->szPage = 1;
|
||||
p->szExtra = szExtra;
|
||||
assert( szExtra>=8 ); /* First 8 bytes will be zeroed */
|
||||
p->bPurgeable = bPurgeable;
|
||||
p->eCreate = 2;
|
||||
p->xStress = xStress;
|
||||
@@ -465,7 +472,7 @@ static SQLITE_NOINLINE PgHdr *pcacheFetchFinishWithInit(
|
||||
pPgHdr->pPage = pPage;
|
||||
pPgHdr->pData = pPage->pBuf;
|
||||
pPgHdr->pExtra = (void *)&pPgHdr[1];
|
||||
memset(pPgHdr->pExtra, 0, pCache->szExtra);
|
||||
memset(pPgHdr->pExtra, 0, 8);
|
||||
pPgHdr->pCache = pCache;
|
||||
pPgHdr->pgno = pgno;
|
||||
pPgHdr->flags = PGHDR_CLEAN;
|
||||
|
||||
Reference in New Issue
Block a user