/ Check-in [59568844]
Login

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

Overview
Comment:Fix more compiler warnings. (CVS 5074)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 59568844e774dbe89fd20bbc8f49a3665cc54717
User & Date: drh 2008-05-01 17:16:53
Context
2008-05-01
18:01
Fix a problem with journal files being created unnecessarily when doing an atomic write in exclusive access locking mode. Fix a test script problem. (CVS 5075) check-in: 70e70866 user: drh tags: trunk
17:16
Fix more compiler warnings. (CVS 5074) check-in: 59568844 user: drh tags: trunk
17:03
Fix harmless compiler warnings. (CVS 5073) check-in: 227a6f67 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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.483 2008/04/28 18:46:43 drh Exp $
           25  +** $Id: build.c,v 1.484 2008/05/01 17:16:53 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.
................................................................................
   155    155       ** (Bit 0 is for main, bit 1 is for temp, and so forth.)  Bits are
   156    156       ** set for each database that is used.  Generate code to start a
   157    157       ** transaction on each used database and to verify the schema cookie
   158    158       ** on each used database.
   159    159       */
   160    160       if( pParse->cookieGoto>0 ){
   161    161         u32 mask;
   162         -      int iDb, i;
          162  +      int iDb;
   163    163         sqlite3VdbeJumpHere(v, pParse->cookieGoto-1);
   164    164         for(iDb=0, mask=1; iDb<db->nDb; mask<<=1, iDb++){
   165    165           if( (mask & pParse->cookieMask)==0 ) continue;
   166    166           sqlite3VdbeUsesBtree(v, iDb);
   167    167           sqlite3VdbeAddOp2(v,OP_Transaction, iDb, (mask & pParse->writeMask)!=0);
   168    168           sqlite3VdbeAddOp2(v,OP_VerifyCookie, iDb, pParse->cookieValue[iDb]);
   169    169         }
   170    170   #ifndef SQLITE_OMIT_VIRTUALTABLE
   171         -      for(i=0; i<pParse->nVtabLock; i++){
   172         -        char *vtab = (char *)pParse->apVtabLock[i]->pVtab;
   173         -        sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
          171  +      {
          172  +        int i;
          173  +        for(i=0; i<pParse->nVtabLock; i++){
          174  +          char *vtab = (char *)pParse->apVtabLock[i]->pVtab;
          175  +          sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
          176  +        }
          177  +        pParse->nVtabLock = 0;
   174    178         }
   175         -      pParse->nVtabLock = 0;
   176    179   #endif
   177    180   
   178    181         /* Once all the cookies have been verified and transactions opened, 
   179    182         ** obtain the required table-locks. This is a no-op unless the 
   180    183         ** shared-cache feature is enabled.
   181    184         */
   182    185         codeTableLocks(pParse);

Changes to src/expr.c.

     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   ** This file contains routines used for analyzing expressions and
    13     13   ** for generating VDBE code that evaluates expressions in SQLite.
    14     14   **
    15         -** $Id: expr.c,v 1.370 2008/04/29 00:15:21 drh Exp $
           15  +** $Id: expr.c,v 1.371 2008/05/01 17:16:53 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /*
    21     21   ** Return the 'affinity' of the expression pExpr if any.
    22     22   **
................................................................................
   262    262     sqlite3 *db,            /* Handle for sqlite3DbMallocZero() (may be null) */
   263    263     int op,                 /* Expression opcode */
   264    264     Expr *pLeft,            /* Left operand */
   265    265     Expr *pRight,           /* Right operand */
   266    266     const Token *pToken     /* Argument token */
   267    267   ){
   268    268     Expr *pNew;
   269         -  static const Expr zeroExpr;
   270         -  pNew = sqlite3DbMallocRaw(db, sizeof(Expr));
          269  +  pNew = sqlite3DbMallocZero(db, sizeof(Expr));
   271    270     if( pNew==0 ){
   272    271       /* When malloc fails, delete pLeft and pRight. Expressions passed to 
   273    272       ** this function must always be allocated with sqlite3Expr() for this 
   274    273       ** reason. 
   275    274       */
   276    275       sqlite3ExprDelete(pLeft);
   277    276       sqlite3ExprDelete(pRight);
   278    277       return 0;
   279    278     }
   280         -  *pNew = zeroExpr;
   281    279     pNew->op = op;
   282    280     pNew->pLeft = pLeft;
   283    281     pNew->pRight = pRight;
   284    282     pNew->iAgg = -1;
   285    283     if( pToken ){
   286    284       assert( pToken->dyn==0 );
   287    285       pNew->span = pNew->token = *pToken;

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.437 2008/05/01 17:03:49 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.438 2008/05/01 17:16:53 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include <assert.h>
    26     26   #include <string.h>
    27     27   
    28     28   /*
................................................................................
   512    512   ** the btree layer handle that chore.
   513    513   */
   514    514   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
   515    515     static void pagerEnter(Pager *p){
   516    516       p->iInUseDB++;
   517    517       if( p->iInUseMM && p->iInUseDB==1 ){
   518    518         sqlite3_mutex *mutex;
          519  +#ifndef SQLITE_MUTEX_NOOP
   519    520         mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2);
          521  +#endif
   520    522         p->iInUseDB = 0;
   521    523         sqlite3_mutex_enter(mutex);
   522    524         p->iInUseDB = 1;
   523    525         sqlite3_mutex_leave(mutex);
   524    526       }
   525    527       assert( p->iInUseMM==0 );
   526    528     }
................................................................................
  2320   2322     /* pPager->pBusyHandler = 0; */
  2321   2323     /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
  2322   2324     *ppPager = pPager;
  2323   2325   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  2324   2326     pPager->iInUseMM = 0;
  2325   2327     pPager->iInUseDB = 0;
  2326   2328     if( !memDb ){
         2329  +#ifndef SQLITE_MUTEX_NOOP
  2327   2330       sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2);
         2331  +#endif
  2328   2332       sqlite3_mutex_enter(mutex);
  2329   2333       pPager->pNext = sqlite3PagerList;
  2330   2334       if( sqlite3PagerList ){
  2331   2335         assert( sqlite3PagerList->pPrev==0 );
  2332   2336         sqlite3PagerList->pPrev = pPager;
  2333   2337       }
  2334   2338       pPager->pPrev = 0;
................................................................................
  2702   2706   ** is made to roll it back. If an error occurs during the rollback 
  2703   2707   ** a hot journal may be left in the filesystem but no error is returned
  2704   2708   ** to the caller.
  2705   2709   */
  2706   2710   int sqlite3PagerClose(Pager *pPager){
  2707   2711   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  2708   2712     if( !MEMDB ){
         2713  +#ifndef SQLITE_MUTEX_NOOP
  2709   2714       sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2);
         2715  +#endif
  2710   2716       sqlite3_mutex_enter(mutex);
  2711   2717       if( pPager->pPrev ){
  2712   2718         pPager->pPrev->pNext = pPager->pNext;
  2713   2719       }else{
  2714   2720         sqlite3PagerList = pPager->pNext;
  2715   2721       }
  2716   2722       if( pPager->pNext ){
................................................................................
  3219   3225     sqlite3_mutex *mutex;       /* The MEM2 mutex */
  3220   3226     Pager *pPager;              /* For looping over pagers */
  3221   3227     BusyHandler *savedBusy;     /* Saved copy of the busy handler */
  3222   3228     int rc = SQLITE_OK;
  3223   3229   
  3224   3230     /* Acquire the memory-management mutex
  3225   3231     */
         3232  +#ifndef SQLITE_MUTEX_NOOP
  3226   3233     mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2);
         3234  +#endif
  3227   3235     sqlite3_mutex_enter(mutex);
  3228   3236   
  3229   3237     /* Signal all database connections that memory management wants
  3230   3238     ** to have access to the pagers.
  3231   3239     */
  3232   3240     for(pPager=sqlite3PagerList; pPager; pPager=pPager->pNext){
  3233   3241        pPager->iInUseMM = 1;

Changes to src/tclsqlite.c.

     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   ** A TCL Interface to SQLite.  Append this file to sqlite3.c and
    13     13   ** compile the whole thing to build a TCL-enabled version of SQLite.
    14     14   **
    15         -** $Id: tclsqlite.c,v 1.216 2008/04/16 00:28:14 drh Exp $
           15  +** $Id: tclsqlite.c,v 1.217 2008/05/01 17:16:53 drh Exp $
    16     16   */
    17     17   #include "tcl.h"
    18     18   #include <errno.h>
    19     19   
    20     20   /*
    21     21   ** Some additional include files are needed if this file is not
    22     22   ** appended to the amalgamation.
................................................................................
   475    475     rc = Tcl_VarEval(pDb->interp, pDb->zBusy, " ", zVal, (char*)0);
   476    476     if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){
   477    477       return 0;
   478    478     }
   479    479     return 1;
   480    480   }
   481    481   
          482  +#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
   482    483   /*
   483    484   ** This routine is invoked as the 'progress callback' for the database.
   484    485   */
   485    486   static int DbProgressHandler(void *cd){
   486    487     SqliteDb *pDb = (SqliteDb*)cd;
   487    488     int rc;
   488    489   
................................................................................
   489    490     assert( pDb->zProgress );
   490    491     rc = Tcl_Eval(pDb->interp, pDb->zProgress);
   491    492     if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){
   492    493       return 1;
   493    494     }
   494    495     return 0;
   495    496   }
          497  +#endif
   496    498   
   497    499   #ifndef SQLITE_OMIT_TRACE
   498    500   /*
   499    501   ** This routine is called by the SQLite trace handler whenever a new
   500    502   ** block of SQL is executed.  The TCL script in pDb->zTrace is executed.
   501    503   */
   502    504   static void DbTraceHandler(void *cd, const char *zSql){

Changes to src/test_schema.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing the virtual table interfaces.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test_schema.c,v 1.13 2007/08/16 04:30:40 drh Exp $
           16  +** $Id: test_schema.c,v 1.14 2008/05/01 17:16:53 drh Exp $
    17     17   */
    18     18   
    19     19   /* The code in this file defines a sqlite3 virtual-table module that
    20     20   ** provides a read-only view of the current database schema. There is one
    21     21   ** row in the schema table for each column in the database schema.
    22     22   */
    23     23   #define SCHEMA \
................................................................................
    62     62     sqlite3_vtab_cursor base;
    63     63     sqlite3_stmt *pDbList;
    64     64     sqlite3_stmt *pTableList;
    65     65     sqlite3_stmt *pColumnList;
    66     66     int rowid;
    67     67   };
    68     68   
           69  +/*
           70  +** None of this works unless we have virtual tables.
           71  +*/
           72  +#ifndef SQLITE_OMIT_VIRTUALTABLE
           73  +
    69     74   /*
    70     75   ** Table destructor for the schema module.
    71     76   */
    72     77   static int schemaDestroy(sqlite3_vtab *pVtab){
    73     78     sqlite3_free(pVtab);
    74     79     return 0;
    75     80   }
................................................................................
   283    288     0,                           /* xSync */
   284    289     0,                           /* xCommit */
   285    290     0,                           /* xRollback */
   286    291     0,                           /* xFindMethod */
   287    292     0,                           /* xRename */
   288    293   };
   289    294   
          295  +#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
   290    296   
   291    297   #ifdef SQLITE_TEST
   292    298   
   293    299   /*
   294    300   ** Decode a pointer to an sqlite3 object.
   295    301   */
   296    302   static int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb){

Changes to src/vdbeapi.c.

    43     43   
    44     44   /*
    45     45   ** Check that the list looks to be internally consistent. This is used
    46     46   ** as part of an assert() statement as follows:
    47     47   **
    48     48   **   assert( stmtLruCheck() );
    49     49   */
           50  +#ifndef NDEBUG
    50     51   static int stmtLruCheck(){
    51     52     Vdbe *p;
    52     53     for(p=sqlite3LruStatements.pFirst; p; p=p->pLruNext){
    53     54       assert(p->pLruNext || p==sqlite3LruStatements.pLast);
    54     55       assert(!p->pLruNext || p->pLruNext->pLruPrev==p);
    55     56       assert(p->pLruPrev || p==sqlite3LruStatements.pFirst);
    56     57       assert(!p->pLruPrev || p->pLruPrev->pLruNext==p);
    57     58     }
    58     59     return 1;
    59     60   }
           61  +#endif
    60     62   
    61     63   /*
    62     64   ** Add vdbe p to the end of the statement lru list. It is assumed that
    63     65   ** p is not already part of the list when this is called. The lru list
    64     66   ** is protected by the SQLITE_MUTEX_STATIC_LRU mutex.
    65     67   */
    66     68   static void stmtLruAdd(Vdbe *p){