Remove most static and global variables from a pure build. There
are still a number of static and global variables used for testing. (CVS 3342) FossilOrigin-Name: 76e4d4187779097954038e444111f837737e789c
This commit is contained in:
parent
ffc13f69b5
commit
0f7eb61108
24
manifest
24
manifest
@ -1,5 +1,5 @@
|
||||
C Reset\sthe\sschema\sbefore\schecking\sfor\soutstanding\sstatements\sinside\nsqlite3_close()\sso\sthat\svirtual\stables\swill\sbe\sdisconnected.\s(CVS\s3341)
|
||||
D 2006-07-30T20:50:45
|
||||
C Remove\smost\sstatic\sand\sglobal\svariables\sfrom\sa\spure\sbuild.\s\sThere\nare\sstill\sa\snumber\sof\sstatic\sand\sglobal\svariables\sused\sfor\stesting.\s(CVS\s3342)
|
||||
D 2006-08-08T13:51:43
|
||||
F Makefile.in 9c2a76055c305868cc5f5b73e29a252ff3632c0a
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -34,7 +34,7 @@ F src/alter.c eba661e77bfd00282fbfa316cdb6aef04856fedc
|
||||
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
|
||||
F src/attach.c b11eb4d5d3fb99a10a626956bccc7215f6b68b16
|
||||
F src/auth.c 902f4722661c796b97f007d9606bd7529c02597f
|
||||
F src/btree.c fc077741b35efd2015b0f56e62d00370bed1fcc8
|
||||
F src/btree.c c4757940df58fc0914d2c4f1778a66101df2c6b9
|
||||
F src/btree.h 061c50e37de7f50b58528e352d400cf33ead7418
|
||||
F src/build.c 2ea8ad0e2e49b3957692588182524e6c390ab5a9
|
||||
F src/callback.c fd9bb39f7ff6b52bad8365617abc61c720640429
|
||||
@ -62,10 +62,10 @@ F src/os_unix.c 17d91581a0ab478a06cb6f257b707a4c4a93e5a7
|
||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||
F src/os_win.c c6976ae50b61fb5b7dce399e578aa1865f02b84f
|
||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||
F src/pager.c 2ae998a64f98bc2fa14893e08537365865a09519
|
||||
F src/pager.h 43f32f3847421f7502cfbb66f4eb2302b8033818
|
||||
F src/pager.c e51c079b3cad8394898a6c22330150339103700a
|
||||
F src/pager.h 0cff9de5e9019cb695a04d18df8caaaff933a272
|
||||
F src/parse.y ecac666005bec0c813681a81de88d1de5d27577f
|
||||
F src/pragma.c 27d5e395c5d950931c7ac4fe610e7c2993e2fa55
|
||||
F src/pragma.c cc12939bb74a6e28eb2e867e75175eecffe089a1
|
||||
F src/prepare.c 06fdfea0920f2fe67df29ce6b2eebc83a9e6aedf
|
||||
F src/printf.c b179b6ed12f793e028dd169e2e2e2b2a37eedc63
|
||||
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
|
||||
@ -97,11 +97,11 @@ F src/update.c 951f95ef044cf6d28557c48dc35cb0711a0b9129
|
||||
F src/utf.c 4459801e9b00cfd69993bfca58545d3775682d6e
|
||||
F src/util.c 5409031819ee4672c5f9c3ac7cf517e267a25845
|
||||
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
|
||||
F src/vdbe.c 106bc6216f1bf0176ae645813647b7c496ace962
|
||||
F src/vdbe.c 3cea0b930abca02facd4c01fc6f369015730a926
|
||||
F src/vdbe.h 258b5d1c0aaa72192f09ff0568ce42b383f156fa
|
||||
F src/vdbeInt.h e3eaab262b67b84474625cfc38aec1125c32834b
|
||||
F src/vdbeapi.c a2274726d16893337c60937235040fc36792cb48
|
||||
F src/vdbeaux.c f3d25be011aa5b883166466ed06c7c40dbc6cc2e
|
||||
F src/vdbeapi.c 81f531d7dc5c898131b02ef85f6c6144ab2892cf
|
||||
F src/vdbeaux.c e850cdfa3a2a575cdd79a0a998dab812a01e10d3
|
||||
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
||||
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
|
||||
F src/vtab.c cae036dc7b0b7d7f5f17eef646b1d53940a21572
|
||||
@ -377,7 +377,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P 47353f62ca7635b693718997e792358d16bd117b
|
||||
R 9a3e9175ab65d62b48310a673dd1e811
|
||||
P af05c3ca06163ef92ca1ca135302c00b7ddddabf
|
||||
R f5ef17a5493e5cfcde82b3eadef654c3
|
||||
U drh
|
||||
Z fc59d02196f8c93727c6028eaedb3295
|
||||
Z 67d07ebceb0040add56e64c2bec7e348
|
||||
|
@ -1 +1 @@
|
||||
af05c3ca06163ef92ca1ca135302c00b7ddddabf
|
||||
76e4d4187779097954038e444111f837737e789c
|
14
src/btree.c
14
src/btree.c
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.325 2006/06/27 16:34:57 danielk1977 Exp $
|
||||
** $Id: btree.c,v 1.326 2006/08/08 13:51:43 drh Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
@ -426,10 +426,10 @@ struct BtCursor {
|
||||
#if SQLITE_TEST
|
||||
# define TRACE(X) if( sqlite3_btree_trace )\
|
||||
{ sqlite3DebugPrintf X; fflush(stdout); }
|
||||
int sqlite3_btree_trace=0; /* True to enable tracing */
|
||||
#else
|
||||
# define TRACE(X)
|
||||
#endif
|
||||
int sqlite3_btree_trace=0; /* True to enable tracing */
|
||||
|
||||
/*
|
||||
** Forward declaration
|
||||
@ -2367,7 +2367,7 @@ static int autoVacuumCommit(BtShared *pBt, Pgno *nTrunc){
|
||||
MemPage *pFreeMemPage = 0; /* "" */
|
||||
|
||||
#ifndef NDEBUG
|
||||
int nRef = *sqlite3pager_stats(pPager);
|
||||
int nRef = sqlite3pager_refcount(pPager);
|
||||
#endif
|
||||
|
||||
assert( pBt->autoVacuum );
|
||||
@ -2475,7 +2475,7 @@ static int autoVacuumCommit(BtShared *pBt, Pgno *nTrunc){
|
||||
assert( finSize!=PENDING_BYTE_PAGE(pBt) );
|
||||
|
||||
autovacuum_out:
|
||||
assert( nRef==*sqlite3pager_stats(pPager) );
|
||||
assert( nRef==sqlite3pager_refcount(pPager) );
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3pager_rollback(pPager);
|
||||
}
|
||||
@ -6388,7 +6388,7 @@ char *sqlite3BtreeIntegrityCheck(Btree *p, int *aRoot, int nRoot){
|
||||
IntegrityCk sCheck;
|
||||
BtShared *pBt = p->pBt;
|
||||
|
||||
nRef = *sqlite3pager_stats(pBt->pPager);
|
||||
nRef = sqlite3pager_refcount(pBt->pPager);
|
||||
if( lockBtreeWithRetry(p)!=SQLITE_OK ){
|
||||
return sqliteStrDup("Unable to acquire a read lock on the database");
|
||||
}
|
||||
@ -6454,10 +6454,10 @@ char *sqlite3BtreeIntegrityCheck(Btree *p, int *aRoot, int nRoot){
|
||||
/* Make sure this analysis did not leave any unref() pages
|
||||
*/
|
||||
unlockBtreeIfUnused(pBt);
|
||||
if( nRef != *sqlite3pager_stats(pBt->pPager) ){
|
||||
if( nRef != sqlite3pager_refcount(pBt->pPager) ){
|
||||
checkAppendMsg(&sCheck, 0,
|
||||
"Outstanding page count goes from %d to %d during this analysis",
|
||||
nRef, *sqlite3pager_stats(pBt->pPager)
|
||||
nRef, sqlite3pager_refcount(pBt->pPager)
|
||||
);
|
||||
}
|
||||
|
||||
|
19
src/pager.c
19
src/pager.c
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.270 2006/06/28 18:18:09 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.271 2006/08/08 13:51:43 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -370,7 +370,7 @@ static const unsigned char aJournalMagic[] = {
|
||||
/*
|
||||
** Enable reference count tracking (for debugging) here:
|
||||
*/
|
||||
#ifdef SQLITE_DEBUG
|
||||
#ifdef SQLITE_TEST
|
||||
int pager3_refinfo_enable = 0;
|
||||
static void pager_refinfo(PgHdr *p){
|
||||
static int cnt = 0;
|
||||
@ -1535,7 +1535,9 @@ void sqlite3pager_set_safety_level(Pager *pPager, int level, int full_fsync){
|
||||
** attempts to open a temporary file. This information is used for
|
||||
** testing and analysis only.
|
||||
*/
|
||||
#ifdef SQLITE_TEST
|
||||
int sqlite3_opentemp_count = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Open a temporary file. Write the name of the file into zFile
|
||||
@ -1549,7 +1551,9 @@ int sqlite3_opentemp_count = 0;
|
||||
static int sqlite3pager_opentemp(char *zFile, OsFile **pFd){
|
||||
int cnt = 8;
|
||||
int rc;
|
||||
#ifdef SQLITE_TEST
|
||||
sqlite3_opentemp_count++; /* Used for testing and analysis only */
|
||||
#endif
|
||||
do{
|
||||
cnt--;
|
||||
sqlite3OsTempFileName(zFile);
|
||||
@ -3497,6 +3501,14 @@ int sqlite3pager_isreadonly(Pager *pPager){
|
||||
return pPager->readOnly;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the number of references to the pager.
|
||||
*/
|
||||
int sqlite3pager_refcount(Pager *pPager){
|
||||
return pPager->nRef;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_TEST
|
||||
/*
|
||||
** This routine is used for testing and analysis only.
|
||||
*/
|
||||
@ -3508,15 +3520,14 @@ int *sqlite3pager_stats(Pager *pPager){
|
||||
a[3] = pPager->dbSize;
|
||||
a[4] = pPager->state;
|
||||
a[5] = pPager->errCode;
|
||||
#ifdef SQLITE_TEST
|
||||
a[6] = pPager->nHit;
|
||||
a[7] = pPager->nMiss;
|
||||
a[8] = pPager->nOvfl;
|
||||
a[9] = pPager->nRead;
|
||||
a[10] = pPager->nWrite;
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Set the statement rollback point.
|
||||
|
@ -13,7 +13,7 @@
|
||||
** subsystem. The page cache subsystem reads and writes a file a page
|
||||
** at a time and provides a journal for rollback.
|
||||
**
|
||||
** @(#) $Id: pager.h,v 1.50 2006/03/06 18:23:17 drh Exp $
|
||||
** @(#) $Id: pager.h,v 1.51 2006/08/08 13:51:43 drh Exp $
|
||||
*/
|
||||
|
||||
#ifndef _PAGER_H_
|
||||
@ -98,6 +98,7 @@ int sqlite3pager_stmt_commit(Pager*);
|
||||
int sqlite3pager_stmt_rollback(Pager*);
|
||||
void sqlite3pager_dont_rollback(void*);
|
||||
void sqlite3pager_dont_write(Pager*, Pgno);
|
||||
int sqlite3pager_refcount(Pager*);
|
||||
int *sqlite3pager_stats(Pager*);
|
||||
void sqlite3pager_set_safety_level(Pager*,int,int);
|
||||
const char *sqlite3pager_filename(Pager*);
|
||||
|
13
src/pragma.c
13
src/pragma.c
@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to implement the PRAGMA command.
|
||||
**
|
||||
** $Id: pragma.c,v 1.120 2006/03/03 21:20:17 drh Exp $
|
||||
** $Id: pragma.c,v 1.121 2006/08/08 13:51:43 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -780,7 +780,7 @@ void sqlite3Pragma(
|
||||
** useful if invoked immediately after the main database i
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft, "encoding")==0 ){
|
||||
static struct EncName {
|
||||
static const struct EncName {
|
||||
char *zName;
|
||||
u8 enc;
|
||||
} encnames[] = {
|
||||
@ -790,12 +790,11 @@ void sqlite3Pragma(
|
||||
{ "UTF16le", SQLITE_UTF16LE },
|
||||
{ "UTF-16be", SQLITE_UTF16BE },
|
||||
{ "UTF16be", SQLITE_UTF16BE },
|
||||
{ "UTF-16", 0 /* Filled in at run-time */ },
|
||||
{ "UTF16", 0 /* Filled in at run-time */ },
|
||||
{ "UTF-16", 0 }, /* SQLITE_UTF16NATIVE */
|
||||
{ "UTF16", 0 }, /* SQLITE_UTF16NATIVE */
|
||||
{ 0, 0 }
|
||||
};
|
||||
struct EncName *pEnc;
|
||||
encnames[6].enc = encnames[7].enc = SQLITE_UTF16NATIVE;
|
||||
const struct EncName *pEnc;
|
||||
if( !zRight ){ /* "PRAGMA encoding" */
|
||||
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
|
||||
sqlite3VdbeSetNumCols(v, 1);
|
||||
@ -820,7 +819,7 @@ void sqlite3Pragma(
|
||||
){
|
||||
for(pEnc=&encnames[0]; pEnc->zName; pEnc++){
|
||||
if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){
|
||||
ENC(pParse->db) = pEnc->enc;
|
||||
ENC(pParse->db) = pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
14
src/vdbe.c
14
src/vdbe.c
@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.572 2006/07/26 13:43:31 drh Exp $
|
||||
** $Id: vdbe.c,v 1.573 2006/08/08 13:51:43 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -57,7 +57,9 @@
|
||||
** working correctly. This variable has no function other than to
|
||||
** help verify the correct operation of the library.
|
||||
*/
|
||||
#ifdef SQLITE_TEST
|
||||
int sqlite3_search_count = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** When this global variable is positive, it gets decremented once before
|
||||
@ -67,7 +69,9 @@ int sqlite3_search_count = 0;
|
||||
** This facility is used for testing purposes only. It does not function
|
||||
** in an ordinary build.
|
||||
*/
|
||||
#ifdef SQLITE_TEST
|
||||
int sqlite3_interrupt_count = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The next global variable is incremented each type the OP_Sort opcode
|
||||
@ -76,7 +80,9 @@ int sqlite3_interrupt_count = 0;
|
||||
** has no function other than to help verify the correct operation of the
|
||||
** library.
|
||||
*/
|
||||
#ifdef SQLITE_TEST
|
||||
int sqlite3_sort_count = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Release the memory associated with the given stack level. This
|
||||
@ -2824,7 +2830,9 @@ case OP_MoveGt: { /* no-push */
|
||||
pC->deferredMoveto = 0;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
*pC->pIncrKey = 0;
|
||||
#ifdef SQLITE_TEST
|
||||
sqlite3_search_count++;
|
||||
#endif
|
||||
if( oc==OP_MoveGe || oc==OP_MoveGt ){
|
||||
if( res<0 ){
|
||||
rc = sqlite3BtreeNext(pC->pCursor, &res);
|
||||
@ -3582,8 +3590,10 @@ case OP_Last: { /* no-push */
|
||||
** correctly optimizing out sorts.
|
||||
*/
|
||||
case OP_Sort: { /* no-push */
|
||||
#ifdef SQLITE_TEST
|
||||
sqlite3_sort_count++;
|
||||
sqlite3_search_count--;
|
||||
#endif
|
||||
/* Fall through into OP_Rewind */
|
||||
}
|
||||
/* Opcode: Rewind P1 P2 *
|
||||
@ -3656,7 +3666,9 @@ case OP_Next: { /* no-push */
|
||||
}
|
||||
if( res==0 ){
|
||||
pc = pOp->p2 - 1;
|
||||
#ifdef SQLITE_TEST
|
||||
sqlite3_search_count++;
|
||||
#endif
|
||||
}
|
||||
}else{
|
||||
pC->nullRow = 1;
|
||||
|
@ -383,10 +383,9 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){
|
||||
Vdbe *pVm = (Vdbe *)pStmt;
|
||||
int vals = sqlite3_data_count(pStmt);
|
||||
if( i>=vals || i<0 ){
|
||||
static Mem nullMem;
|
||||
if( nullMem.flags==0 ){ nullMem.flags = MEM_Null; }
|
||||
static const Mem nullMem = {0, 0.0, "", 0, MEM_Null, MEM_Null };
|
||||
sqlite3Error(pVm->db, SQLITE_RANGE, 0);
|
||||
return &nullMem;
|
||||
return (Mem*)&nullMem;
|
||||
}
|
||||
return &pVm->pTos[(1-vals)+i];
|
||||
}
|
||||
|
@ -782,7 +782,9 @@ void sqlite3VdbeMakeReady(
|
||||
resizeOpArray(p, p->nOp);
|
||||
assert( nVar>=0 );
|
||||
assert( nStack<p->nOp );
|
||||
nStack = isExplain ? 10 : nStack;
|
||||
if( isExplain ){
|
||||
nStack = 10;
|
||||
}
|
||||
p->aStack = sqliteMalloc(
|
||||
nStack*sizeof(p->aStack[0]) /* aStack */
|
||||
+ nArg*sizeof(Mem*) /* apArg */
|
||||
|
Loading…
Reference in New Issue
Block a user