From 7c2d87cd71cc09d7a50529541a6205ce57f0a865 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 2 Sep 2006 14:16:59 +0000 Subject: [PATCH] Convert static variables into constants in the FTS module. (CVS 3385) FossilOrigin-Name: 098cbafcd6dcf57142b0417e796d27ffddcc0920 --- ext/fts1/fts1.c | 10 +++++----- ext/fts1/fts1_tokenizer.h | 4 ++-- ext/fts1/fts1_tokenizer1.c | 8 +++++--- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/tclsqlite.c | 9 +-------- src/vtab.c | 4 ++-- 7 files changed, 26 insertions(+), 31 deletions(-) diff --git a/ext/fts1/fts1.c b/ext/fts1/fts1.c index 6b193665bd..ade52b69bd 100644 --- a/ext/fts1/fts1.c +++ b/ext/fts1/fts1.c @@ -575,7 +575,7 @@ typedef enum fulltext_statement { ** query joins a virtual table to itself? If so perhaps we should ** move some of these to the cursor object. */ -static const char *fulltext_zStatement[MAX_STMT] = { +static const char *const fulltext_zStatement[MAX_STMT] = { /* CONTENT_INSERT */ "insert into %_content (rowid, content) values (?, ?)", /* CONTENT_SELECT */ "select content from %_content where rowid = ?", /* CONTENT_DELETE */ "delete from %_content where rowid = ?", @@ -618,7 +618,7 @@ static struct fulltext_vtab *cursor_vtab(fulltext_cursor *c){ return (fulltext_vtab *) c->base.pVtab; } -static sqlite3_module fulltextModule; /* forward declaration */ +static const sqlite3_module fulltextModule; /* forward declaration */ /* Puts a freshly-prepared statement determined by iStmt in *ppStmt. ** If the indicated statement has never been prepared, it is prepared @@ -889,7 +889,7 @@ static int fulltextConnect(sqlite3 *db, void *pAux, int argc, char **argv, sqlite3_vtab **ppVTab){ int rc; fulltext_vtab *v; - sqlite3_tokenizer_module *m = NULL; + const sqlite3_tokenizer_module *m = NULL; assert( argc>=3 ); v = (fulltext_vtab *) malloc(sizeof(fulltext_vtab)); @@ -1168,7 +1168,7 @@ static void queryDestroy(Query *q){ static int tokenizeSegment(sqlite3_tokenizer *pTokenizer, const char *pSegment, int nSegment, int inPhrase, Query *pQuery){ - sqlite3_tokenizer_module *pModule = pTokenizer->pModule; + const sqlite3_tokenizer_module *pModule = pTokenizer->pModule; sqlite3_tokenizer_cursor *pCursor; int is_first = 1; @@ -1514,7 +1514,7 @@ static int fulltextUpdate(sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg, pRowid); } -static sqlite3_module fulltextModule = { +static const sqlite3_module fulltextModule = { 0, fulltextCreate, fulltextConnect, diff --git a/ext/fts1/fts1_tokenizer.h b/ext/fts1/fts1_tokenizer.h index 5e5010f759..225f176c2a 100644 --- a/ext/fts1/fts1_tokenizer.h +++ b/ext/fts1/fts1_tokenizer.h @@ -66,7 +66,7 @@ struct sqlite3_tokenizer_module { }; struct sqlite3_tokenizer { - sqlite3_tokenizer_module *pModule; /* The module for this tokenizer */ + const sqlite3_tokenizer_module *pModule; /* The module for this tokenizer */ /* Tokenizer implementations will typically add additional fields */ }; @@ -84,6 +84,6 @@ struct sqlite3_tokenizer_cursor { /* TODO(shess) This doesn't belong here. Need some sort of ** registration process. */ -void sqlite3Fts1SimpleTokenizerModule(sqlite3_tokenizer_module **ppModule); +void sqlite3Fts1SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule); #endif /* _FTS1_TOKENIZER_H_ */ diff --git a/ext/fts1/fts1_tokenizer1.c b/ext/fts1/fts1_tokenizer1.c index 416c9b66ad..ef8a6f74e9 100644 --- a/ext/fts1/fts1_tokenizer1.c +++ b/ext/fts1/fts1_tokenizer1.c @@ -44,7 +44,9 @@ typedef struct simple_tokenizer_cursor { int nTokenAllocated; /* space allocated to zToken buffer */ } simple_tokenizer_cursor; -static sqlite3_tokenizer_module simpleTokenizerModule;/* forward declaration */ + +/* Forward declaration */ +static const sqlite3_tokenizer_module simpleTokenizerModule; static int isDelim(simple_tokenizer *t, unsigned char c){ return c<0x80 && t->delim[c]; @@ -163,7 +165,7 @@ static int simpleNext( return SQLITE_DONE; } -static sqlite3_tokenizer_module simpleTokenizerModule = { +static const sqlite3_tokenizer_module simpleTokenizerModule = { 0, simpleCreate, simpleDestroy, @@ -173,7 +175,7 @@ static sqlite3_tokenizer_module simpleTokenizerModule = { }; void sqlite3Fts1SimpleTokenizerModule( - sqlite3_tokenizer_module **ppModule + sqlite3_tokenizer_module const**ppModule ){ *ppModule = &simpleTokenizerModule; } diff --git a/manifest b/manifest index 4e01f2ac86..2713bf6fc2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Automatically\sregister\sthe\sFTS\smodule\sif\sit\sis\scompiled\sinto\sthe\sbuild.\s(CVS\s3384) -D 2006-09-02T13:58:07 +C Convert\sstatic\svariables\sinto\sconstants\sin\sthe\sFTS\smodule.\s(CVS\s3385) +D 2006-09-02T14:17:00 F Makefile.in 659b63368cfbb95a224c9d2f2a9897802d96a4ea F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -21,12 +21,12 @@ F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1 F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b F ext/fts1/ft_hash.h 1a35e654a235c2c662d3ca0dfc3138ad60b8b7d5 -F ext/fts1/fts1.c 98f1b10b6af53dc665eee9bccf7179c817b54b3c +F ext/fts1/fts1.c c8532f1367150245d7d9dab4178159eeafeeece9 F ext/fts1/fts1.h fe8e8f38dd6d2d2645b9b0d6972e80985249575f F ext/fts1/fts1_hash.c 3196cee866edbebb1c0521e21672e6d599965114 F ext/fts1/fts1_hash.h 957d378355ed29f672cd5add012ce8b088a5e089 -F ext/fts1/fts1_tokenizer.h 887580709d32e44ca4ee3c7107c06ee444eb44c2 -F ext/fts1/fts1_tokenizer1.c 03a9af15f252cf0ee3d518be8c2f48b3eb1d31a1 +F ext/fts1/fts1_tokenizer.h a90c4d022d1c5e50ca931a9b6415bc8bce12b76e +F ext/fts1/fts1_tokenizer1.c 1155942be01e8b191b13ac2ea4604b301f77e73e F ext/fts1/fulltext.c d935e600d87bc86b7d64f55c7520ea41d6034c5c F ext/fts1/fulltext.h 08525a47852d1d62a0be81d3fc3fe2d23b094efd F ext/fts1/simple_tokenizer.c 1844d72f7194c3fd3d7e4173053911bf0661b70d @@ -90,7 +90,7 @@ F src/sqlite.h.in 84ac26ca94a84dd603fb57a27d862f51bfd9f687 F src/sqlite3ext.h 11a046b3519c4b9b7709e6d6a95c3a36366f684a F src/sqliteInt.h 325a2d45be2b22c1e21ad649e0a898c74eaec7de F src/table.c d8817f43a6c6bf139487db161760b9e1e02da3f1 -F src/tclsqlite.c fae9746f1da8ab888364a5ba02e691922e0a184e +F src/tclsqlite.c e029f739bed90071789fe81a226d53e97a80a4d8 F src/test1.c 535294d7f21a4127082c4f7a57f225482df9cc36 F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b F src/test3.c 85135c09560c48bdb0a23c9b890ab405486b8ec9 @@ -119,7 +119,7 @@ F src/vdbeapi.c 81f531d7dc5c898131b02ef85f6c6144ab2892cf F src/vdbeaux.c 9fab61427a0741c9c123e8ff16e349b1f90397be F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5 F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3 -F src/vtab.c cae036dc7b0b7d7f5f17eef646b1d53940a21572 +F src/vtab.c 6067f9ec011880fadb04be1ca24dbe30c575a5bf F src/where.c 75a89957fcb8c068bec55caa4e9d2ed5fa0b0724 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -395,7 +395,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P e6e49a3811d4b26518026cc1692c654e8edbf741 -R 300b9738759115b8e19a01418309b320 +P 8a96bdb72439c0b337cbaa2d07897d0896ea3024 +R 05da3dd8f2c28296657c8de18470d807 U drh -Z 653f283d344be54f865316af17b0e6ad +Z a3892b4353b377a4e8243da61653303c diff --git a/manifest.uuid b/manifest.uuid index 3841d7b47f..ba08143fba 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8a96bdb72439c0b337cbaa2d07897d0896ea3024 \ No newline at end of file +098cbafcd6dcf57142b0417e796d27ffddcc0920 \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 7a88e96341..7eec3af29f 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.172 2006/08/31 15:07:15 drh Exp $ +** $Id: tclsqlite.c,v 1.173 2006/09/02 14:17:00 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -2073,13 +2073,6 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ zArg = Tcl_GetStringFromObj(objv[1], 0); Tcl_CreateObjCommand(interp, zArg, DbObjCmd, (char*)p, DbDeleteCmd); -#ifdef SQLITE_ENABLE_FTS1 - { - extern int sqlite3Fts1Init(sqlite3*); - sqlite3Fts1Init(p->db); - } -#endif - /* If compiled with SQLITE_TEST turned on, then register the "md5sum" ** SQL function. */ diff --git a/src/vtab.c b/src/vtab.c index 2bb1571664..be6b98823e 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to help implement virtual tables. ** -** $Id: vtab.c,v 1.29 2006/07/26 16:22:15 danielk1977 Exp $ +** $Id: vtab.c,v 1.30 2006/09/02 14:17:00 drh Exp $ */ #ifndef SQLITE_OMIT_VIRTUALTABLE #include "sqliteInt.h" @@ -139,7 +139,7 @@ void sqlite3VtabBeginParse( */ static void addArgumentToVtab(Parse *pParse){ if( pParse->sArg.z && pParse->pNewTable ){ - const char *z = pParse->sArg.z; + const char *z = (const char*)pParse->sArg.z; int n = pParse->sArg.n; addModuleArgument(pParse->pNewTable, sqliteStrNDup(z, n)); } -- 2.47.2