/ Check-in [b51782cc]
Login

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

Overview
Comment:Silence a harmless unitialised variable warning in btree.c. Ticket #2862. (CVS 4650)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b51782ccac28598eec7adc9302fe7d1986bfdaf8
User & Date: danielk1977 2008-01-01 06:19:02
Context
2008-01-01
19:02
Optimize trigger compilation to avoid populating the OLD.* and NEW.* pseudo-tables with data that will never be used. Some testing to come. (CVS 4651) check-in: e08a33ed user: danielk1977 tags: trunk
06:19
Silence a harmless unitialised variable warning in btree.c. Ticket #2862. (CVS 4650) check-in: b51782cc user: danielk1977 tags: trunk
05:49
Define SQLITE_CORE=1 at the start of the amalgamation file for the benefit of any extension source code (i.e. fts3) appended to it. Ticket #2858. (CVS 4649) check-in: 6dea8c16 user: danielk1977 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.434 2007/12/21 04:47:26 danielk1977 Exp $
           12  +** $Id: btree.c,v 1.435 2008/01/01 06:19:02 danielk1977 Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** See the header comment on "btreeInt.h" for additional information.
    16     16   ** Including a description of file format and an overview of operation.
    17     17   */
    18     18   #include "btreeInt.h"
    19     19   
................................................................................
  5725   5725       ** do something we will leave a hole on an internal page.
  5726   5726       ** We have to fill the hole by moving in a cell from a leaf.  The
  5727   5727       ** next Cell after the one to be deleted is guaranteed to exist and
  5728   5728       ** to be a leaf so we can use it.
  5729   5729       */
  5730   5730       BtCursor leafCur;
  5731   5731       unsigned char *pNext;
  5732         -    int szNext;  /* The compiler warning is wrong: szNext is always 
  5733         -                 ** initialized before use.  Adding an extra initialization
  5734         -                 ** to silence the compiler slows down the code. */
  5735   5732       int notUsed;
  5736   5733       unsigned char *tempCell = 0;
  5737   5734       assert( !pPage->leafData );
  5738   5735       sqlite3BtreeGetTempCursor(pCur, &leafCur);
  5739   5736       rc = sqlite3BtreeNext(&leafCur, &notUsed);
  5740   5737       if( rc==SQLITE_OK ){
  5741   5738         rc = sqlite3PagerWrite(leafCur.pPage->pDbPage);
  5742   5739       }
  5743   5740       if( rc==SQLITE_OK ){
         5741  +      int szNext;
  5744   5742         TRACE(("DELETE: table=%d delete internal from %d replace from leaf %d\n",
  5745   5743            pCur->pgnoRoot, pPage->pgno, leafCur.pPage->pgno));
  5746   5744         dropCell(pPage, pCur->idx, cellSizePtr(pPage, pCell));
  5747   5745         pNext = findCell(leafCur.pPage, leafCur.idx);
  5748   5746         szNext = cellSizePtr(leafCur.pPage, pNext);
  5749   5747         assert( MX_CELL_SIZE(pBt)>=szNext+4 );
  5750   5748         tempCell = sqlite3_malloc( MX_CELL_SIZE(pBt) );
  5751   5749         if( tempCell==0 ){
  5752   5750           rc = SQLITE_NOMEM;
  5753   5751         }
  5754         -    }
  5755         -    if( rc==SQLITE_OK ){
  5756         -      rc = insertCell(pPage, pCur->idx, pNext-4, szNext+4, tempCell, 0);
  5757         -    }
  5758         -    if( rc==SQLITE_OK ){
  5759         -      put4byte(findOverflowCell(pPage, pCur->idx), pgnoChild);
  5760         -      rc = balance(pPage, 0);
  5761         -    }
  5762         -    if( rc==SQLITE_OK ){
  5763         -      dropCell(leafCur.pPage, leafCur.idx, szNext);
  5764         -      rc = balance(leafCur.pPage, 0);
         5752  +      if( rc==SQLITE_OK ){
         5753  +        rc = insertCell(pPage, pCur->idx, pNext-4, szNext+4, tempCell, 0);
         5754  +      }
         5755  +      if( rc==SQLITE_OK ){
         5756  +        put4byte(findOverflowCell(pPage, pCur->idx), pgnoChild);
         5757  +        rc = balance(pPage, 0);
         5758  +      }
         5759  +      if( rc==SQLITE_OK ){
         5760  +        dropCell(leafCur.pPage, leafCur.idx, szNext);
         5761  +        rc = balance(leafCur.pPage, 0);
         5762  +      }
  5765   5763       }
  5766   5764       sqlite3_free(tempCell);
  5767   5765       sqlite3BtreeReleaseTempCursor(&leafCur);
  5768   5766     }else{
  5769   5767       TRACE(("DELETE: table=%d delete from leaf %d\n",
  5770   5768          pCur->pgnoRoot, pPage->pgno));
  5771   5769       dropCell(pPage, pCur->idx, cellSizePtr(pPage, pCell));