/ Check-in [c7da3aa9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Code size reductions in the pager. (CVS 2952)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c7da3aa9bdf7b788424633015000955606e93f48
User & Date: drh 2006-01-15 20:28:28
Context
2006-01-16
00:05
Version 3.3.1 (withdrawn - see ticket #1614) (CVS 2955) check-in: ed0f1d90 user: drh tags: trunk
2006-01-15
20:28
Code size reductions in the pager. (CVS 2952) check-in: c7da3aa9 user: drh tags: trunk
18:29
Prepare for the 3.3.1 alpha release. (CVS 2951) check-in: 3e32bcf0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.236 2006/01/11 21:41:22 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.237 2006/01/15 20:28:28 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include "os.h"
    26     26   #include "pager.h"
    27     27   #include <assert.h>
    28     28   #include <string.h>
................................................................................
   427    427   ** Read a 32-bit integer from the given file descriptor.  Store the integer
   428    428   ** that is read in *pRes.  Return SQLITE_OK if everything worked, or an
   429    429   ** error code is something goes wrong.
   430    430   **
   431    431   ** All values are stored on disk as big-endian.
   432    432   */
   433    433   static int read32bits(OsFile *fd, u32 *pRes){
   434         -  u32 res;
   435         -  int rc;
   436         -  rc = sqlite3OsRead(fd, &res, sizeof(res));
          434  +  unsigned char ac[4];
          435  +  int rc = sqlite3OsRead(fd, ac, sizeof(ac));
   437    436     if( rc==SQLITE_OK ){
   438         -    unsigned char ac[4];
   439         -    memcpy(ac, &res, 4);
   440         -    res = (ac[0]<<24) | (ac[1]<<16) | (ac[2]<<8) | ac[3];
          437  +    *pRes = (ac[0]<<24) | (ac[1]<<16) | (ac[2]<<8) | ac[3];
   441    438     }
   442         -  *pRes = res;
   443    439     return rc;
   444    440   }
   445    441   
   446    442   /*
   447    443   ** Write a 32-bit integer into a string buffer in big-endian byte order.
   448    444   */
   449    445   static void put32bits(char *ac, u32 val){
................................................................................
  1687   1683   
  1688   1684     for(i=nameLen; i>0 && pPager->zDirectory[i-1]!='/'; i--){}
  1689   1685     if( i>0 ) pPager->zDirectory[i-1] = 0;
  1690   1686     strcpy(pPager->zJournal, zFullPathname);
  1691   1687     sqliteFree(zFullPathname);
  1692   1688     strcpy(&pPager->zJournal[nameLen], "-journal");
  1693   1689     pPager->fd = fd;
  1694         -  pPager->journalOpen = 0;
         1690  +  /* pPager->journalOpen = 0; */
  1695   1691     pPager->useJournal = useJournal && !memDb;
  1696   1692     pPager->noReadlock = noReadlock && readOnly;
  1697         -  pPager->stmtOpen = 0;
  1698         -  pPager->stmtInUse = 0;
  1699         -  pPager->nRef = 0;
         1693  +  /* pPager->stmtOpen = 0; */
         1694  +  /* pPager->stmtInUse = 0; */
         1695  +  /* pPager->nRef = 0; */
  1700   1696     pPager->dbSize = memDb-1;
  1701   1697     pPager->pageSize = SQLITE_DEFAULT_PAGE_SIZE;
  1702         -  pPager->stmtSize = 0;
  1703         -  pPager->stmtJSize = 0;
  1704         -  pPager->nPage = 0;
  1705         -  pPager->nMaxPage = 0;
         1698  +  /* pPager->stmtSize = 0; */
         1699  +  /* pPager->stmtJSize = 0; */
         1700  +  /* pPager->nPage = 0; */
         1701  +  /* pPager->nMaxPage = 0; */
  1706   1702     pPager->mxPage = 100;
  1707         -  pPager->state = PAGER_UNLOCK;
  1708         -  pPager->errMask = 0;
         1703  +  assert( PAGER_UNLOCK==0 );
         1704  +  /* pPager->state = PAGER_UNLOCK; */
         1705  +  /* pPager->errMask = 0; */
  1709   1706     pPager->tempFile = tempFile;
  1710   1707     pPager->memDb = memDb;
  1711   1708     pPager->readOnly = readOnly;
  1712         -  pPager->needSync = 0;
         1709  +  /* pPager->needSync = 0; */
  1713   1710     pPager->noSync = pPager->tempFile || !useJournal;
  1714   1711     pPager->fullSync = (pPager->noSync?0:1);
  1715         -  pPager->pFirst = 0;
  1716         -  pPager->pFirstSynced = 0;
  1717         -  pPager->pLast = 0;
         1712  +  /* pPager->pFirst = 0; */
         1713  +  /* pPager->pFirstSynced = 0; */
         1714  +  /* pPager->pLast = 0; */
  1718   1715     pPager->nExtra = FORCE_ALIGNMENT(nExtra);
  1719   1716     pPager->sectorSize = PAGER_SECTOR_SIZE;
  1720         -  pPager->pBusyHandler = 0;
  1721         -  memset(pPager->aHash, 0, sizeof(pPager->aHash));
         1717  +  /* pPager->pBusyHandler = 0; */
         1718  +  /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
  1722   1719     *ppPager = pPager;
  1723   1720   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  1724   1721     if( pTsdro->useMemoryManagement ){
  1725   1722       ThreadData *pTsd = sqlite3ThreadData();
  1726   1723       pPager->pNext = pTsd->pPager;
  1727   1724       pTsd->pPager = pPager;
  1728   1725     }