/ Check-in [61b31e77]
Login

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

Overview
Comment:Convert two unreachable branches into assert() statements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 61b31e771430f490fc2c4cef55046debc4a5f4f5
User & Date: drh 2014-12-02 16:16:47
Context
2014-12-02
20:51
Add support for SQLITE_CHECKPOINT_TRUNCATE. check-in: edda2b9e user: drh tags: trunk
19:04
Add the SQLITE_CHECKPOINT_TRUNCATE option. check-in: 8e20a434 user: dan tags: checkpoint-truncate
16:38
Merge all recent enhancements and bug fixes from trunk into the apple-osx branch. check-in: 43c4ba26 user: drh tags: apple-osx
16:31
Merge all recent fixes and enhancements from trunk into sessions. check-in: 2617d937 user: drh tags: sessions
16:16
Convert two unreachable branches into assert() statements. check-in: 61b31e77 user: drh tags: trunk
13:46
Work around overzealous NULL pointer checking in memcpy() and memset() for some systems. check-in: 0d04f380 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  1352   1352   
  1353   1353     /* The request could not be fulfilled using a freelist slot.  Check
  1354   1354     ** to see if defragmentation is necessary.
  1355   1355     */
  1356   1356     testcase( gap+2+nByte==top );
  1357   1357     if( gap+2+nByte>top ){
  1358   1358    defragment_page:
  1359         -    testcase( pPage->nCell==0 );
         1359  +    assert( pPage->nCell>0 || CORRUPT_DB );
  1360   1360       rc = defragmentPage(pPage);
  1361   1361       if( rc ) return rc;
  1362   1362       top = get2byteNotZero(&data[hdr+5]);
  1363   1363       assert( gap+nByte<=top );
  1364   1364     }
  1365   1365   
  1366   1366   
................................................................................
  6412   6412     Pgno pgnoNew;                        /* Page number of pNew */
  6413   6413   
  6414   6414     assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  6415   6415     assert( sqlite3PagerIswriteable(pParent->pDbPage) );
  6416   6416     assert( pPage->nOverflow==1 );
  6417   6417   
  6418   6418     /* This error condition is now caught prior to reaching this function */
  6419         -  if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT;
         6419  +  if( NEVER(pPage->nCell==0) ) return SQLITE_CORRUPT_BKPT;
  6420   6420   
  6421   6421     /* Allocate a new page. This page will become the right-sibling of 
  6422   6422     ** pPage. Make the parent page writable, so that the new divider cell
  6423   6423     ** may be inserted. If both these operations are successful, proceed.
  6424   6424     */
  6425   6425     rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
  6426   6426