/ Check-in [cdfe372a]
Login

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

Overview
Comment:Remove a few unused variables detected by Borland C. Ticket #1412. (CVS 2675)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cdfe372a958fb446485913e860d52b87fffd34e4
User & Date: drh 2005-09-08 14:17:20
Context
2005-09-08
19:01
Remove a C++ism that snuck in on one of the reason changes. (CVS 2676) check-in: 48f6a331 user: drh tags: trunk
14:17
Remove a few unused variables detected by Borland C. Ticket #1412. (CVS 2675) check-in: cdfe372a user: drh tags: trunk
12:57
Aggregates with GROUP BY can sometimes return no result rows. (CVS 2674) check-in: 0c3e368d 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.265 2005/08/27 16:36:49 drh Exp $
           12  +** $Id: btree.c,v 1.266 2005/09/08 14:17: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.
................................................................................
  2477   2477   static const unsigned char *fetchPayload(
  2478   2478     BtCursor *pCur,      /* Cursor pointing to entry to read from */
  2479   2479     int *pAmt,           /* Write the number of available bytes here */
  2480   2480     int skipKey          /* read beginning at data if this is true */
  2481   2481   ){
  2482   2482     unsigned char *aPayload;
  2483   2483     MemPage *pPage;
  2484         -  Btree *pBt;
  2485   2484     u32 nKey;
  2486   2485     int nLocal;
  2487   2486   
  2488   2487     assert( pCur!=0 && pCur->pPage!=0 );
  2489   2488     assert( pCur->isValid );
  2490         -  pBt = pCur->pBt;
  2491   2489     pPage = pCur->pPage;
  2492   2490     pageIntegrity(pPage);
  2493   2491     assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
  2494   2492     getCellInfo(pCur);
  2495   2493     aPayload = pCur->info.pCell;
  2496   2494     aPayload += pCur->info.nHeader;
  2497   2495     if( pPage->intKey ){
................................................................................
  2581   2579   **
  2582   2580   ** pCur->idx is set to the cell index that contains the pointer
  2583   2581   ** to the page we are coming from.  If we are coming from the
  2584   2582   ** right-most child page then pCur->idx is set to one more than
  2585   2583   ** the largest cell index.
  2586   2584   */
  2587   2585   static void moveToParent(BtCursor *pCur){
  2588         -  Pgno oldPgno;
  2589   2586     MemPage *pParent;
  2590   2587     MemPage *pPage;
  2591   2588     int idxParent;
  2592   2589   
  2593   2590     assert( pCur->isValid );
  2594   2591     pPage = pCur->pPage;
  2595   2592     assert( pPage!=0 );
................................................................................
  2596   2593     assert( !isRootPage(pPage) );
  2597   2594     pageIntegrity(pPage);
  2598   2595     pParent = pPage->pParent;
  2599   2596     assert( pParent!=0 );
  2600   2597     pageIntegrity(pParent);
  2601   2598     idxParent = pPage->idxParent;
  2602   2599     sqlite3pager_ref(pParent->aData);
  2603         -  oldPgno = pPage->pgno;
  2604   2600     releasePage(pPage);
  2605   2601     pCur->pPage = pParent;
  2606   2602     pCur->info.nSize = 0;
  2607   2603     assert( pParent->idxShift==0 );
  2608   2604     pCur->idx = idxParent;
  2609   2605   }
  2610   2606   
................................................................................
  5476   5472     MemPage *pPage;
  5477   5473     int i, rc, depth, d2, pgno, cnt;
  5478   5474     int hdr, cellStart;
  5479   5475     int nCell;
  5480   5476     u8 *data;
  5481   5477     BtCursor cur;
  5482   5478     Btree *pBt;
  5483         -  int maxLocal, usableSize;
         5479  +  int usableSize;
  5484   5480     char zContext[100];
  5485   5481     char *hit;
  5486   5482   
  5487   5483     sprintf(zContext, "Page %d: ", iPage);
  5488   5484   
  5489   5485     /* Check that the page exists
  5490   5486     */
................................................................................
  5493   5489     if( iPage==0 ) return 0;
  5494   5490     if( checkRef(pCheck, iPage, zParentContext) ) return 0;
  5495   5491     if( (rc = getPage(pBt, (Pgno)iPage, &pPage))!=0 ){
  5496   5492       checkAppendMsg(pCheck, zContext,
  5497   5493          "unable to get the page. error code=%d", rc);
  5498   5494       return 0;
  5499   5495     }
  5500         -  maxLocal = pPage->leafData ? pBt->maxLeaf : pBt->maxLocal;
  5501   5496     if( (rc = initPage(pPage, pParent))!=0 ){
  5502   5497       checkAppendMsg(pCheck, zContext, "initPage() returns error code %d", rc);
  5503   5498       releasePage(pPage);
  5504   5499       return 0;
  5505   5500     }
  5506   5501   
  5507   5502     /* Check out all the cells.

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.346 2005/09/08 00:13:27 drh Exp $
           25  +** $Id: build.c,v 1.347 2005/09/08 14:17:20 drh Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
   128    128   ** Not everything is nestable.  This facility is designed to permit
   129    129   ** INSERT, UPDATE, and DELETE operations against SQLITE_MASTER.  Use
   130    130   ** care if you decide to try to use this routine for some other purposes.
   131    131   */
   132    132   void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
   133    133     va_list ap;
   134    134     char *zSql;
   135         -  int rc;
   136    135   # define SAVE_SZ  (sizeof(Parse) - offsetof(Parse,nVar))
   137    136     char saveBuf[SAVE_SZ];
   138    137   
   139    138     if( pParse->nErr ) return;
   140    139     assert( pParse->nested<10 );  /* Nesting should only be of limited depth */
   141    140     va_start(ap, zFormat);
   142    141     zSql = sqlite3VMPrintf(zFormat, ap);
................................................................................
   143    142     va_end(ap);
   144    143     if( zSql==0 ){
   145    144       return;   /* A malloc must have failed */
   146    145     }
   147    146     pParse->nested++;
   148    147     memcpy(saveBuf, &pParse->nVar, SAVE_SZ);
   149    148     memset(&pParse->nVar, 0, SAVE_SZ);
   150         -  rc = sqlite3RunParser(pParse, zSql, 0);
          149  +  sqlite3RunParser(pParse, zSql, 0);
   151    150     sqliteFree(zSql);
   152    151     memcpy(&pParse->nVar, saveBuf, SAVE_SZ);
   153    152     pParse->nested--;
   154    153   }
   155    154   
   156    155   /*
   157    156   ** Locate the in-memory structure that describes a particular database
................................................................................
   632    631     Token *pStart,   /* The "CREATE" token */
   633    632     Token *pName1,   /* First part of the name of the table or view */
   634    633     Token *pName2,   /* Second part of the name of the table or view */
   635    634     int isTemp,      /* True if this is a TEMP table */
   636    635     int isView       /* True if this is a VIEW */
   637    636   ){
   638    637     Table *pTable;
   639         -  Index *pIdx;
   640    638     char *zName = 0; /* The name of the new table */
   641    639     sqlite3 *db = pParse->db;
   642    640     Vdbe *v;
   643    641     int iDb;         /* Database number to create the table in */
   644    642     Token *pName;    /* Unqualified name of the table to create */
   645    643   
   646    644     /* The table or view name to create is passed to this routine via tokens
................................................................................
   711    709       goto begin_table_error;
   712    710     }
   713    711     pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName);
   714    712     if( pTable ){
   715    713       sqlite3ErrorMsg(pParse, "table %T already exists", pName);
   716    714       goto begin_table_error;
   717    715     }
   718         -  if( (pIdx = sqlite3FindIndex(db, zName, 0))!=0 && 
   719         -      ( iDb==0 || !db->init.busy) ){
          716  +  if( sqlite3FindIndex(db, zName, 0)!=0 && (iDb==0 || !db->init.busy) ){
   720    717       sqlite3ErrorMsg(pParse, "there is already an index named %s", zName);
   721    718       goto begin_table_error;
   722    719     }
   723    720     pTable = sqliteMalloc( sizeof(Table) );
   724    721     if( pTable==0 ){
   725    722       pParse->rc = SQLITE_NOMEM;
   726    723       pParse->nErr++;
................................................................................
  2112   2109       zName = sqlite3NameFromToken(pName);
  2113   2110       if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index;
  2114   2111       if( zName==0 ) goto exit_create_index;
  2115   2112       if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
  2116   2113         goto exit_create_index;
  2117   2114       }
  2118   2115       if( !db->init.busy ){
  2119         -      Index *pISameName;    /* Another index with the same name */
  2120         -      Table *pTSameName;    /* A table with same name as the index */
  2121   2116         if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index;
  2122         -      if( (pISameName = sqlite3FindIndex(db, zName, db->aDb[iDb].zName))!=0 ){
         2117  +      if( sqlite3FindIndex(db, zName, db->aDb[iDb].zName)!=0 ){
  2123   2118           sqlite3ErrorMsg(pParse, "index %s already exists", zName);
  2124   2119           goto exit_create_index;
  2125   2120         }
  2126         -      if( (pTSameName = sqlite3FindTable(db, zName, 0))!=0 ){
         2121  +      if( sqlite3FindTable(db, zName, 0)!=0 ){
  2127   2122           sqlite3ErrorMsg(pParse, "there is already a table named %s", zName);
  2128   2123           goto exit_create_index;
  2129   2124         }
  2130   2125       }
  2131   2126     }else{
  2132   2127       char zBuf[30];
  2133   2128       int n;

Changes to src/sqliteInt.h.

     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     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.411 2005/09/08 02:00:26 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.412 2005/09/08 14:17:20 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** These #defines should enable >2GB file support on Posix if the
    21     21   ** underlying operating system supports it.  If the OS lacks
................................................................................
  1596   1596   void sqlite3VdbeSetChanges(sqlite3 *, int);
  1597   1597   void sqlite3utf16Substr(sqlite3_context *,int,sqlite3_value **);
  1598   1598   
  1599   1599   const void *sqlite3ValueText(sqlite3_value*, u8);
  1600   1600   int sqlite3ValueBytes(sqlite3_value*, u8);
  1601   1601   void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, void(*)(void*));
  1602   1602   void sqlite3ValueFree(sqlite3_value*);
  1603         -sqlite3_value *sqlite3ValueNew();
         1603  +sqlite3_value *sqlite3ValueNew(void);
  1604   1604   sqlite3_value *sqlite3GetTransientValue(sqlite3*db);
  1605   1605   int sqlite3ValueFromExpr(Expr *, u8, u8, sqlite3_value **);
  1606   1606   void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
  1607   1607   extern const unsigned char sqlite3UpperToLower[];
  1608   1608   void sqlite3RootPageMoved(Db*, int, int);
  1609   1609   void sqlite3Reindex(Parse*, Token*, Token*);
  1610   1610   void sqlite3AlterFunctions(sqlite3*);

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.484 2005/09/07 23:05:22 drh Exp $
           46  +** $Id: vdbe.c,v 1.485 2005/09/08 14:17:20 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  3654   3654   ** an epsilon prior to the comparison.  This makes the opcode work
  3655   3655   ** like IdxLE.
  3656   3656   */
  3657   3657   case OP_IdxLT:          /* no-push */
  3658   3658   case OP_IdxGT:          /* no-push */
  3659   3659   case OP_IdxGE: {        /* no-push */
  3660   3660     int i= pOp->p1;
  3661         -  BtCursor *pCrsr;
  3662   3661     Cursor *pC;
  3663   3662   
  3664   3663     assert( i>=0 && i<p->nCursor );
  3665   3664     assert( p->apCsr[i]!=0 );
  3666   3665     assert( pTos>=p->aStack );
  3667         -  if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
         3666  +  if( (pC = p->apCsr[i])->pCursor!=0 ){
  3668   3667       int res, rc;
  3669   3668    
  3670   3669       assert( pTos->flags & MEM_Blob );  /* Created using OP_Make*Key */
  3671   3670       Stringify(pTos, db->enc);
  3672   3671       assert( pC->deferredMoveto==0 );
  3673   3672       *pC->pIncrKey = pOp->p3!=0;
  3674   3673       assert( pOp->p3==0 || pOp->opcode!=OP_IdxGT );

Changes to src/vdbemem.c.

   725    725     }
   726    726     return (const void *)(pVal->z);
   727    727   }
   728    728   
   729    729   /*
   730    730   ** Create a new sqlite3_value object.
   731    731   */
   732         -sqlite3_value* sqlite3ValueNew(){
          732  +sqlite3_value* sqlite3ValueNew(void){
   733    733     Mem *p = sqliteMalloc(sizeof(*p));
   734    734     if( p ){
   735    735       p->flags = MEM_Null;
   736    736       p->type = SQLITE_NULL;
   737    737     }
   738    738     return p;
   739    739   }

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is reponsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.168 2005/09/01 17:47:51 drh Exp $
           19  +** $Id: where.c,v 1.169 2005/09/08 14:17:20 drh Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23     23   /*
    24     24   ** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
    25     25   */
    26     26   #define BMS  (sizeof(Bitmask)*8)
................................................................................
   533    533     WhereClause *pWC,         /* the WHERE clause */
   534    534     int idxTerm               /* Index of the term to be analyzed */
   535    535   ){
   536    536     WhereTerm *pTerm = &pWC->a[idxTerm];
   537    537     Expr *pExpr = pTerm->pExpr;
   538    538     Bitmask prereqLeft;
   539    539     Bitmask prereqAll;
   540         -  int idxRight;
   541    540     int nPattern;
   542    541     int isComplete;
   543    542   
   544    543     if( sqlite3_malloc_failed ) return;
   545    544     prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft);
   546    545     pTerm->prereqRight = exprTableUsage(pMaskSet, pExpr->pRight);
   547    546     pTerm->prereqAll = prereqAll = exprTableUsage(pMaskSet, pExpr);
   548    547     pTerm->leftCursor = -1;
   549    548     pTerm->iParent = -1;
   550    549     pTerm->operator = 0;
   551         -  idxRight = -1;
   552    550     if( allowedOp(pExpr->op) && (pTerm->prereqRight & prereqLeft)==0 ){
   553    551       Expr *pLeft = pExpr->pLeft;
   554    552       Expr *pRight = pExpr->pRight;
   555    553       if( pLeft->op==TK_COLUMN ){
   556    554         pTerm->leftCursor = pLeft->iTable;
   557    555         pTerm->leftColumn = pLeft->iColumn;
   558    556         pTerm->operator = operatorMask(pExpr->op);