Remove global variables when compiled with SQLITE_OMIT_WSD

FossilOrigin-Name: dd10a547f10364058025c48b28d8fd240bf46aff
This commit is contained in:
drh 2010-06-03 12:09:52 +00:00
parent 1f55e28d2a
commit f83dc1ef3f
9 changed files with 53 additions and 26 deletions

View File

@ -1,5 +1,8 @@
C Enhancements\sto\stest_vfs.c\sand\swalfault.test. -----BEGIN PGP SIGNED MESSAGE-----
D 2010-06-03T09:25:10 Hash: SHA1
C Remove\sglobal\svariables\swhen\scompiled\swith\sSQLITE_OMIT_WSD
D 2010-06-03T12:09:52
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -124,7 +127,7 @@ F src/expr.c 7b1df28226b8a2bb2b9d7c794a42818a81f5edd8
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e2116672a6bd610dc888e27df292ebc7999c9bb0 F src/fkey.c e2116672a6bd610dc888e27df292ebc7999c9bb0
F src/func.c 0c28599430856631216b6c0131c51c89bf516026 F src/func.c 0c28599430856631216b6c0131c51c89bf516026
F src/global.c 5a9c1e3c93213ca574786ac1caa976ce8f709105 F src/global.c 3fedfe02f1b2b1f6118455c881d132b804a1f0a7
F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970 F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
@ -133,14 +136,14 @@ F src/journal.c b0ea6b70b532961118ab70301c00a33089f9315c
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581 F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581
F src/main.c 5f857e9fc62cc4e39f31fecc894e43ee2498b7e0 F src/main.c 34d9fc068b331e7d13206c26490c42f90c83d893
F src/malloc.c a08f16d134f0bfab6b20c3cd142ebf3e58235a6a F src/malloc.c a08f16d134f0bfab6b20c3cd142ebf3e58235a6a
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2 F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2
F src/mem2.c 2ee7bdacda8299b5a91cff9f7ee3e46573195c38 F src/mem2.c 2ee7bdacda8299b5a91cff9f7ee3e46573195c38
F src/mem3.c 9b237d911ba9904142a804be727cc6664873f8a3 F src/mem3.c 9b237d911ba9904142a804be727cc6664873f8a3
F src/mem5.c eb7a5cb98915dd7a086fa415ce3a5a0f20d0acff F src/mem5.c eb7a5cb98915dd7a086fa415ce3a5a0f20d0acff
F src/memjournal.c f3be374af30588de297dcf678925b2a4758e4135 F src/memjournal.c b6c760f64e3c784deeb56bb2b9e8a955563c80bc
F src/mutex.c 6949180803ff05a7d0e2b9334a95b4fb5a00e23f F src/mutex.c 6949180803ff05a7d0e2b9334a95b4fb5a00e23f
F src/mutex.h 6fde601e55fa6c3fae768783c439797ab84c87c6 F src/mutex.h 6fde601e55fa6c3fae768783c439797ab84c87c6
F src/mutex_noop.c e6c3e448ac0514b27af1f8949f0347e4340f7af3 F src/mutex_noop.c e6c3e448ac0514b27af1f8949f0347e4340f7af3
@ -149,7 +152,7 @@ F src/mutex_unix.c cf84466b4fdd2baa0d5a10bb19f08b2abc1ce42e
F src/mutex_w32.c 1fe0e735897be20e09dd6f53c3fb516c6b48c0eb F src/mutex_w32.c 1fe0e735897be20e09dd6f53c3fb516c6b48c0eb
F src/notify.c cbfa66a836da3a51567209636e6a94059c137930 F src/notify.c cbfa66a836da3a51567209636e6a94059c137930
F src/os.c 1516984144e26734f97748f891f1a04f9e294c2e F src/os.c 1516984144e26734f97748f891f1a04f9e294c2e
F src/os.h 6f604986f0ef0ca288c2330b16051ff70b431e8c F src/os.h 6f529984a29511c7a3479cfe549c10bfa131532f
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19 F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
F src/os_unix.c 8fa4eeb27c54f26e9ce01bead2fa117fadea1526 F src/os_unix.c 8fa4eeb27c54f26e9ce01bead2fa117fadea1526
@ -170,13 +173,13 @@ F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b
F src/shell.c fd4ccdb37c3b68de0623eb938a649e0990710714 F src/shell.c fd4ccdb37c3b68de0623eb938a649e0990710714
F src/sqlite.h.in 60f4fcfe18bcb53ed0002989837b68aeeba79a5e F src/sqlite.h.in 60f4fcfe18bcb53ed0002989837b68aeeba79a5e
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
F src/sqliteInt.h 4e26920ede6da1b6f154251fb4f89f65f78979e0 F src/sqliteInt.h 242987ebd2366ea36650a09cdab04a9163c62109
F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3 F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3
F src/status.c 4df6fe7dce2d256130b905847c6c60055882bdbe F src/status.c 4df6fe7dce2d256130b905847c6c60055882bdbe
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c 6bc5fbde634b9cb42b3d29d674fa6cd0c22c0881 F src/tclsqlite.c 6bc5fbde634b9cb42b3d29d674fa6cd0c22c0881
F src/test1.c e3e0ad1f0763a1aa6adf7e1c50727718eaa4bd32 F src/test1.c e3e0ad1f0763a1aa6adf7e1c50727718eaa4bd32
F src/test2.c 31f1b9d076b4774a22d2605d0af1f34e14a9a7bd F src/test2.c e3f564ab1e9fd0b47b0c9e23e7054e38bf0836cf
F src/test3.c 4c21700c73a890a47fc685c1097bfb661346ac94 F src/test3.c 4c21700c73a890a47fc685c1097bfb661346ac94
F src/test4.c ad03bb987ddedce928f4258c1e7fa4109a73497d F src/test4.c ad03bb987ddedce928f4258c1e7fa4109a73497d
F src/test5.c cc55900118fa4add8ec9cf69fc4225a4662f76b1 F src/test5.c cc55900118fa4add8ec9cf69fc4225a4662f76b1
@ -219,7 +222,7 @@ F src/vdbe.c 965247d966bb5bc9db819e27c076c8acd43ea4fd
F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3 F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3
F src/vdbeInt.h 19ebc8c2a2e938340051ee65af3f377fb99102d1 F src/vdbeInt.h 19ebc8c2a2e938340051ee65af3f377fb99102d1
F src/vdbeapi.c dc3138f10afbc95ed3c21dd25abb154504b1db9d F src/vdbeapi.c dc3138f10afbc95ed3c21dd25abb154504b1db9d
F src/vdbeaux.c 834a551950e8b2b5bdca7bb353ac04f87dade03f F src/vdbeaux.c 4e96a5169b988a8697d4a417f902277b4152e43e
F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
@ -815,7 +818,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P eb80ddc665132c607c258b59131025a296269dad P ac0de2f39e948f3b00e96eebf56ebee70472020d
R b8571e46e77ae4334ee4b99c40b16506 R 2471c301986d2b1b4e5a7fb5b19f3e34
U dan U drh
Z a97b394e32c2defcb9f264e6738c31ca Z ad4e60ef77cb53f3a930937718481e1b
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMB5uToxKgR168RlERAtsiAJ0VpOsSRORCjjWUhDUeQ1w5dXjvDwCfU7hM
XwNgzrRAo3TBeSKSA2lj8rY=
=avrR
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
ac0de2f39e948f3b00e96eebf56ebee70472020d dd10a547f10364058025c48b28d8fd240bf46aff

View File

@ -194,7 +194,9 @@ SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
** Changing the pending byte during operating results in undefined ** Changing the pending byte during operating results in undefined
** and dileterious behavior. ** and dileterious behavior.
*/ */
#ifndef SQLITE_OMIT_WSD
int sqlite3PendingByte = 0x40000000; int sqlite3PendingByte = 0x40000000;
#endif
#include "opcodes.h" #include "opcodes.h"
/* /*

View File

@ -2381,9 +2381,13 @@ int sqlite3_test_control(int op, ...){
** dileterious behavior. ** dileterious behavior.
*/ */
case SQLITE_TESTCTRL_PENDING_BYTE: { case SQLITE_TESTCTRL_PENDING_BYTE: {
unsigned int newVal = va_arg(ap, unsigned int); rc = PENDING_BYTE;
rc = sqlite3PendingByte; #ifndef SQLITE_OMIT_WSD
if( newVal ) sqlite3PendingByte = newVal; {
unsigned int newVal = va_arg(ap, unsigned int);
if( newVal ) sqlite3PendingByte = newVal;
}
#endif
break; break;
} }

View File

@ -213,7 +213,7 @@ static int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){
/* /*
** Table of methods for MemJournal sqlite3_file object. ** Table of methods for MemJournal sqlite3_file object.
*/ */
static struct sqlite3_io_methods MemJournalMethods = { static const struct sqlite3_io_methods MemJournalMethods = {
1, /* iVersion */ 1, /* iVersion */
memjrnlClose, /* xClose */ memjrnlClose, /* xClose */
memjrnlRead, /* xRead */ memjrnlRead, /* xRead */
@ -236,7 +236,7 @@ void sqlite3MemJournalOpen(sqlite3_file *pJfd){
MemJournal *p = (MemJournal *)pJfd; MemJournal *p = (MemJournal *)pJfd;
assert( EIGHT_BYTE_ALIGNMENT(p) ); assert( EIGHT_BYTE_ALIGNMENT(p) );
memset(p, 0, sqlite3MemJournalSize()); memset(p, 0, sqlite3MemJournalSize());
p->pMethod = &MemJournalMethods; p->pMethod = (sqlite3_io_methods*)&MemJournalMethods;
} }
/* /*

View File

@ -217,7 +217,11 @@
** 1GB boundary. ** 1GB boundary.
** **
*/ */
#define PENDING_BYTE sqlite3PendingByte #ifdef SQLITE_OMIT_WSD
# define PENDING_BYTE (0x40000000)
#else
# define PENDING_BYTE sqlite3PendingByte
#endif
#define RESERVED_BYTE (PENDING_BYTE+1) #define RESERVED_BYTE (PENDING_BYTE+1)
#define SHARED_FIRST (PENDING_BYTE+2) #define SHARED_FIRST (PENDING_BYTE+2)
#define SHARED_SIZE 510 #define SHARED_SIZE 510

View File

@ -2886,8 +2886,10 @@ extern const unsigned char sqlite3UpperToLower[];
extern const unsigned char sqlite3CtypeMap[]; extern const unsigned char sqlite3CtypeMap[];
extern SQLITE_WSD struct Sqlite3Config sqlite3Config; extern SQLITE_WSD struct Sqlite3Config sqlite3Config;
extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
#ifndef SQLITE_OMIT_WSD
extern int sqlite3PendingByte; extern int sqlite3PendingByte;
#endif #endif
#endif
void sqlite3RootPageMoved(Db*, int, int); void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*); void sqlite3Reindex(Parse*, Token*, Token*);
void sqlite3AlterFunctions(void); void sqlite3AlterFunctions(void);

View File

@ -675,7 +675,9 @@ int Sqlitetest2_Init(Tcl_Interp *interp){
(char*)&sqlite3_diskfull_pending, TCL_LINK_INT); (char*)&sqlite3_diskfull_pending, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_diskfull", Tcl_LinkVar(interp, "sqlite_diskfull",
(char*)&sqlite3_diskfull, TCL_LINK_INT); (char*)&sqlite3_diskfull, TCL_LINK_INT);
#ifndef SQLITE_OMIT_WSD
Tcl_LinkVar(interp, "sqlite_pending_byte", Tcl_LinkVar(interp, "sqlite_pending_byte",
(char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY); (char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY);
#endif
return TCL_OK; return TCL_OK;
} }

View File

@ -814,9 +814,12 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
** **
** If a memory allocation error has occurred prior to the calling of this ** If a memory allocation error has occurred prior to the calling of this
** routine, then a pointer to a dummy VdbeOp will be returned. That opcode ** routine, then a pointer to a dummy VdbeOp will be returned. That opcode
** is readable and writable, but it has no effect. The return of a dummy ** is readable but not writable, though it is cast to a writable value.
** opcode allows the call to continue functioning after a OOM fault without ** The return of a dummy opcode allows the call to continue functioning
** having to check to see if the return from this routine is a valid pointer. ** after a OOM fault without having to check to see if the return from
** this routine is a valid pointer. But because the dummy.opcode is 0,
** dummy will never be written to. This is verified by code inspection and
** by running with Valgrind.
** **
** About the #ifdef SQLITE_OMIT_TRACE: Normally, this routine is never called ** About the #ifdef SQLITE_OMIT_TRACE: Normally, this routine is never called
** unless p->nOp>0. This is because in the absense of SQLITE_OMIT_TRACE, ** unless p->nOp>0. This is because in the absense of SQLITE_OMIT_TRACE,
@ -827,17 +830,17 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
** check the value of p->nOp-1 before continuing. ** check the value of p->nOp-1 before continuing.
*/ */
VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){ VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
static VdbeOp dummy; static const VdbeOp dummy;
assert( p->magic==VDBE_MAGIC_INIT ); assert( p->magic==VDBE_MAGIC_INIT );
if( addr<0 ){ if( addr<0 ){
#ifdef SQLITE_OMIT_TRACE #ifdef SQLITE_OMIT_TRACE
if( p->nOp==0 ) return &dummy; if( p->nOp==0 ) return (VdbeOp*)&dummy;
#endif #endif
addr = p->nOp - 1; addr = p->nOp - 1;
} }
assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed ); assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
if( p->db->mallocFailed ){ if( p->db->mallocFailed ){
return &dummy; return (VdbeOp*)&dummy;
}else{ }else{
return &p->aOp[addr]; return &p->aOp[addr];
} }