/ Check-in [c7e647d0]
Login

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

Overview
Comment:Add asserts to btree.c that check for the correct size of various typedefs and structures. Ticket #233. (CVS 845)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c7e647d011b086a6e57420850f6bc4f28fcb23ee
User & Date: drh 2003-01-24 12:14:20
Context
2003-01-25
14:25
Update the speed.html documentation. Recent optimizations have made the library much faster. (CVS 846) check-in: ed47d162 user: drh tags: trunk
2003-01-24
12:14
Add asserts to btree.c that check for the correct size of various typedefs and structures. Ticket #233. (CVS 845) check-in: c7e647d0 user: drh tags: trunk
2003-01-22
01:26
Minor refinements to the pager. (CVS 844) check-in: 19221dee user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree.c,v 1.80 2003/01/05 21:41:41 drh Exp $
           12  +** $Id: btree.c,v 1.81 2003/01/24 12:14:20 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** For a detailed discussion of BTrees, refer to
    16     16   **
    17     17   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    18     18   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    19     19   **     Publishing Company, Reading, Massachusetts.
................................................................................
   671    671     int omitJournal,          /* if TRUE then do not journal this file */
   672    672     int nCache,               /* How many pages in the page cache */
   673    673     Btree **ppBtree           /* Pointer to new Btree object written here */
   674    674   ){
   675    675     Btree *pBt;
   676    676     int rc;
   677    677   
          678  +  /*
          679  +  ** The following asserts make sure that structures used by the btree are
          680  +  ** the right size.  This is to guard against size changes that result
          681  +  ** when compiling on a different architecture.
          682  +  */
          683  +  assert( sizeof(u32)==4 );
          684  +  assert( sizeof(u16)==2 );
          685  +  assert( sizeof(Pgno)==4 );
          686  +  assert( sizeof(PageHdr)==8 );
          687  +  assert( sizeof(CellHdr)==12 );
          688  +  assert( sizeof(FreeBlk)==4 );
          689  +  assert( sizeof(OverflowPage)==SQLITE_PAGE_SIZE );
          690  +  assert( sizeof(FreelistInfo)==OVERFLOW_SIZE );
          691  +  assert( sizeof(ptr)==sizeof(char*) );
          692  +  assert( sizeof(uptr)==sizeof(ptr) );
          693  +
   678    694     pBt = sqliteMalloc( sizeof(*pBt) );
   679    695     if( pBt==0 ){
   680    696       *ppBtree = 0;
   681    697       return SQLITE_NOMEM;
   682    698     }
   683    699     if( nCache<10 ) nCache = 10;
   684    700     rc = sqlitepager_open(&pBt->pPager, zFilename, nCache, EXTRA_SIZE,