diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 8 | ||||
-rw-r--r-- | src/sqliteInt.h | 27 | ||||
-rw-r--r-- | src/tclsqlite.c | 6 | ||||
-rw-r--r-- | src/util.c | 11 | ||||
-rw-r--r-- | src/where.c | 12 |
5 files changed, 31 insertions, 33 deletions
diff --git a/src/btree.c b/src/btree.c index 52a127a33..89c3f9750 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.307 2006/01/22 21:52:57 drh Exp $ +** $Id: btree.c,v 1.308 2006/01/23 13:00:36 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -5282,9 +5282,9 @@ int sqlite3BtreeDelete(BtCursor *pCur){ ** that the entry will be deleted from. */ if( - (rc = restoreOrClearCursorPosition(pCur, 1)) || - (rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur)) || - (rc = sqlite3pager_write(pPage->aData)) + (rc = restoreOrClearCursorPosition(pCur, 1))!=0 || + (rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur))!=0 || + (rc = sqlite3pager_write(pPage->aData))!=0 ){ return rc; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index cee8fc834..0814b1418 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.476 2006/01/23 00:04:55 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.477 2006/01/23 13:00:38 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -73,10 +73,15 @@ #ifdef SQLITE_OMIT_FLOATING_POINT # define double sqlite_int64 # define LONGDOUBLE_TYPE sqlite_int64 -# define SQLITE_BIG_DBL (0x7fffffffffffffff) +# ifndef SQLITE_BIG_DBL +# define SQLITE_BIG_DBL (0x7fffffffffffffff) +# endif # define SQLITE_OMIT_DATETIME_FUNCS 1 # define SQLITE_OMIT_TRACE 1 #endif +#ifndef SQLITE_BIG_DBL +# define SQLITE_BIG_DBL (1e99) +#endif /* ** The maximum number of in-memory pages to use for the main database @@ -693,7 +698,6 @@ struct Table { int tnum; /* Root BTree node for this table (see note above) */ Select *pSelect; /* NULL for tables. Points to definition if a view. */ u8 readOnly; /* True if this table should not be written by the user */ -// u8 iDb; /* Index into sqlite.aDb[] of the backend for this table */ u8 isTransient; /* True if automatically deleted when VDBE finishes */ u8 hasPrimKey; /* True if there exists a primary key */ u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ @@ -957,7 +961,6 @@ struct AggInfo { struct Expr { u8 op; /* Operation performed by this node */ char affinity; /* The affinity of the column or 0 if not a column */ -//u8 iDb; /* Database referenced by this expression */ u8 flags; /* Various flags. See below */ CollSeq *pColl; /* The collation type of the column or 0 */ Expr *pLeft, *pRight; /* Left and right subnodes */ @@ -1742,8 +1745,8 @@ int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*)); int sqlite3ApiExit(sqlite3 *db, int); -int sqlite3MallocFailed(); -void sqlite3FailedMalloc(); +int sqlite3MallocFailed(void); +void sqlite3FailedMalloc(void); #ifndef SQLITE_OMIT_SHARED_CACHE void sqlite3TableLock(Parse *, int, int, u8, const char *); @@ -1752,13 +1755,13 @@ void sqlite3FailedMalloc(); #endif #ifdef SQLITE_MEMDEBUG - void sqlite3MallocDisallow(); - void sqlite3MallocAllow(); - int sqlite3TestMallocFail(); + void sqlite3MallocDisallow(void); + void sqlite3MallocAllow(void); + int sqlite3TestMallocFail(void); #else - #define sqlite3TestMallocFail() 0 - #define sqlite3MallocDisallow() - #define sqlite3MallocAllow() + #define sqlite3TestMallocFail(void) 0 + #define sqlite3MallocDisallow(void) + #define sqlite3MallocAllow(void) #endif #ifdef SQLITE_SSE diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 96e8e274b..427bc45dd 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.149 2006/01/09 23:40:25 drh Exp $ +** $Id: tclsqlite.c,v 1.150 2006/01/23 13:00:38 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -256,6 +256,7 @@ static int DbProgressHandler(void *cd){ return 0; } +#ifndef SQLITE_OMIT_TRACE /* ** This routine is called by the SQLite trace handler whenever a new ** block of SQL is executed. The TCL script in pDb->zTrace is executed. @@ -271,7 +272,9 @@ static void DbTraceHandler(void *cd, const char *zSql){ Tcl_DStringFree(&str); Tcl_ResetResult(pDb->interp); } +#endif +#ifndef SQLITE_OMIT_TRACE /* ** This routine is called by the SQLite profile handler after a statement ** SQL has executed. The TCL script in pDb->zProfile is evaluated. @@ -290,6 +293,7 @@ static void DbProfileHandler(void *cd, const char *zSql, sqlite_uint64 tm){ Tcl_DStringFree(&str); Tcl_ResetResult(pDb->interp); } +#endif /* ** This routine is called when a transaction is committed. The diff --git a/src/util.c b/src/util.c index 233aa7bb5..9f4d08246 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.180 2006/01/20 17:56:33 drh Exp $ +** $Id: util.c,v 1.181 2006/01/23 13:00:38 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -559,7 +559,7 @@ static int handleSoftLimit(int n){ void *sqlite3MallocRaw(int n){ void *p = 0; if( n>0 && !sqlite3MallocFailed() && !handleSoftLimit(n) ){ - while( !(p = OSMALLOC(n)) && sqlite3_release_memory(n) ); + while( (p = OSMALLOC(n))==0 && sqlite3_release_memory(n) ); if( !p ){ /* If the allocation failed, call handleSoftLimit() again, this time ** with the additive inverse of the argument passed to @@ -589,7 +589,7 @@ void *sqlite3Realloc(void *p, int n){ }else{ void *np = 0; if( !handleSoftLimit(n - OSSIZEOF(p)) ){ - while( !(np = OSREALLOC(p, n)) && sqlite3_release_memory(n) ); + while( (np = OSREALLOC(p, n))==0 && sqlite3_release_memory(n) ); if( !np ){ /* If the allocation failed, call handleSoftLimit() again, this time ** with the additive inverse of the argument passed to @@ -743,7 +743,7 @@ void sqlite3SetString(char **pz, ...){ ** to NULL. */ void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){ - if( db && (db->pErr || (db->pErr = sqlite3ValueNew()))!=0 ){ + if( db && (db->pErr || (db->pErr = sqlite3ValueNew())!=0) ){ db->errCode = err_code; if( zFormat ){ char *z; @@ -1337,7 +1337,8 @@ ThreadData *sqlite3ThreadData(){ ** to a substitute ThreadData structure that is all zeros. */ const ThreadData *sqlite3ThreadDataReadOnly(){ - static const ThreadData zeroData; + static const ThreadData zeroData = {0}; /* Initializer to silence warnings + ** from broken compilers */ const ThreadData *pTd = sqlite3OsThreadSpecificData(0); return pTd ? pTd : &zeroData; } diff --git a/src/where.c b/src/where.c index 42766195c..8130bb1ee 100644 --- a/src/where.c +++ b/src/where.c @@ -16,7 +16,7 @@ ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** -** $Id: where.c,v 1.200 2006/01/20 18:10:57 drh Exp $ +** $Id: where.c,v 1.201 2006/01/23 13:00:38 drh Exp $ */ #include "sqliteInt.h" @@ -40,16 +40,6 @@ int sqlite3_where_trace = 0; # define TRACE(X) #endif -/* -** A large value which is the maximum cost of using an index. -** By default this is a large floating point value. When compiling -** SQLite for a processor that lacks floating point support, simply -** redefine this constant to a large integer. -*/ -#ifndef SQLITE_BIG_DBL -# define SQLITE_BIG_DBL (1.0e+99) -#endif - /* Forward reference */ typedef struct WhereClause WhereClause; |