Add lots of new "const" on internal function parameters. There is opportunity
for many more - this is a work in progress. FossilOrigin-Name: a3c71a673ddd1c299bdae550fb955077b77088329a8ca2895dfb23538b524a8e
This commit is contained in:
parent
ebd1ff62c5
commit
b6dad520e5
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Ensure\sthat\ssqlite_stat1\sand\ssqlite_stat4\sare\sordinary\stables\s(not\sviews\sor\nvirtual\stables)\sbefore\strying\sto\sload\sthem\n(dbsqlfuzz\sbc02a0cde82dee801a8d6f653d2831680f87dca1).\s\sThis\sprevents\nsqlite3_declare_vtab()\sfrom\srunning\swith\sdb->init.busy\sturned\son.\s\sEven\sso,\nenhance\ssqlite3_declare_vtab()\sto\sbe\sable\sto\sdeal\swith\sdb->init.busy\sbeing\son,\nin\scase\sthere\sare\sundiscovered\spaths\sto\sthat\sstate.\nEach\sof\sthese\stwo\schanges\sare\sindependently\ssufficient\sto\sprevent\sthe\sproblem\nfixed\sby\sthe\sprevious\scheck-in\s[c7560c1329965ab5]\sbut\sthere\nis\sno\sharm\sin\skeeping\sthat\sthird\slayer\sof\sprotection\sin\splace.
|
||||
D 2021-09-24T12:59:33.753
|
||||
C Add\slots\sof\snew\s"const"\son\sinternal\sfunction\sparameters.\s\sThere\sis\sopportunity\nfor\smany\smore\s-\sthis\sis\sa\swork\sin\sprogress.
|
||||
D 2021-09-24T16:14:47.527
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -481,7 +481,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F src/alter.c a4e20094bb7e6ca5fa832779dc0b6aedfed4cab92144d3bc754fc6dfe6f26f34
|
||||
F src/alter.c a279ff8e6e079dcec20eb736d6399229f4b495f01e6da26052467c9963ead595
|
||||
F src/analyze.c 989eb1146f4a2c320623e190f8913bf1829fd8954a52dbfd0f792efc69db0e66
|
||||
F src/attach.c a514e81758ba7b3a3a0501faf70af6cfc509de8810235db726cfc9f25165e929
|
||||
F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf
|
||||
@ -491,7 +491,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
|
||||
F src/btree.c bed4239e31772ed5486e947d8eaf3d38fcc76136e19d0383bad15609198419c2
|
||||
F src/btree.h 74d64b8f28cfa4a894d14d4ed64fa432cd697b98b61708d4351482ae15913e22
|
||||
F src/btreeInt.h 7bc15a24a02662409ebcd6aeaa1065522d14b7fda71573a2b0568b458f514ae0
|
||||
F src/build.c 8fa6deebf8726339a5aafb322e9d79c48950b994f33f17460c5393ef593d202e
|
||||
F src/build.c 53fe0ecd73c210561eaea965cb4977d7d717e7984005fa814e856868b06f8b23
|
||||
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c 8159d5f706551861c18ec6c8f6bdf105e15ea00367f05d9ab65d31a1077facc1
|
||||
@ -499,7 +499,7 @@ F src/date.c e0632f335952b32401482d099321bbf12716b29d6e72836b53ae49683ebae4bf
|
||||
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
|
||||
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
|
||||
F src/delete.c 3ce6af6b64c8b476de51ccc32da0cb3142d42e65754e1d8118addf65b8bcba15
|
||||
F src/expr.c ce736caaf1cf6d69789511e9fc5ed31013d9570d5d773cce909d396112d83843
|
||||
F src/expr.c 5316aff6218b871550e1a84c76f3343dabd0f1096ec29ad26f14e85c2ccd701e
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c 1905af1821b88321e1bb9d6a69e704495b6844a9b6c29398d40117cc251e893c
|
||||
F src/func.c 812ac5383067bed7150d8597e83c47b714d73db0e62af55811d1a145243e58e1
|
||||
@ -512,7 +512,7 @@ F src/insert.c 16fa4b66709db6db5bb31475f2321d0a839269765aa2461a520c151c385e8b9d
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c 0aa9e7f08e168e3874cb54984408e3976dafdf5616d511952c425b5ac088ea3e
|
||||
F src/main.c 9b99470c8bffc08b3758dca06a6af0961c919db554b58f2ffad51b05147f1186
|
||||
F src/malloc.c cbc93cdd429c4594912017d92ab656e2579aca64dbd1c6888551275bed46f25b
|
||||
F src/malloc.c ef796bcc0e81d845d59a469f1cf235056caf9024172fd524e32136e65593647b
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
||||
F src/mem2.c b93b8762ab999a29ae7751532dadf0a1ac78040308a5fb1d17fcc365171d67eb
|
||||
@ -552,7 +552,7 @@ F src/shell.c.in 9df263dc0949698a8728ecc5bb826666ca8ced75201d5440a161b629455cd46
|
||||
F src/sqlite.h.in 4e977a5e2ed1a9e8987ff65a2cab5f99a4298ebf040ea5ff636e1753339ff45a
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510
|
||||
F src/sqliteInt.h 25af7dcb149966262f0fa485262db638e7058a63f9cfeda6b63a3c8334ca7af3
|
||||
F src/sqliteInt.h 8e88176d15baa0d36b6401042c8b301e9ad28fb34e43a29c0c44001e5a325e94
|
||||
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
||||
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
@ -1926,7 +1926,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P c7560c1329965ab57cd71393c044b110561b83641d08677bc51044df9e377882
|
||||
R d36f6b4bb0a80e7d98d8d352f0785fdc
|
||||
P eb94f4a8174436b1f0deed0a43618a20018387bb815be658314ca6b454c446fb
|
||||
R db077a8e62b070323fd372dd7e91140d
|
||||
U drh
|
||||
Z 660102229a12eb4b87616b09b150cba0
|
||||
Z 4395f669ee70fc34c56697d082f33420
|
||||
|
@ -1 +1 @@
|
||||
eb94f4a8174436b1f0deed0a43618a20018387bb815be658314ca6b454c446fb
|
||||
a3c71a673ddd1c299bdae550fb955077b77088329a8ca2895dfb23538b524a8e
|
38
src/alter.c
38
src/alter.c
@ -689,7 +689,7 @@ void sqlite3AlterRenameColumn(
|
||||
** the parse tree.
|
||||
*/
|
||||
struct RenameToken {
|
||||
void *p; /* Parse tree element created by token t */
|
||||
const void *p; /* Parse tree element created by token t */
|
||||
Token t; /* The token that created parse tree element p */
|
||||
RenameToken *pNext; /* Next is a list of all RenameToken objects */
|
||||
};
|
||||
@ -731,9 +731,9 @@ struct RenameCtx {
|
||||
** Technically, as x no longer points into a valid object or to the byte
|
||||
** following a valid object, it may not be used in comparison operations.
|
||||
*/
|
||||
static void renameTokenCheckAll(Parse *pParse, void *pPtr){
|
||||
static void renameTokenCheckAll(Parse *pParse, const void *pPtr){
|
||||
if( pParse->nErr==0 && pParse->db->mallocFailed==0 ){
|
||||
RenameToken *p;
|
||||
const RenameToken *p;
|
||||
u8 i = 0;
|
||||
for(p=pParse->pRename; p; p=p->pNext){
|
||||
if( p->p ){
|
||||
@ -759,7 +759,11 @@ static void renameTokenCheckAll(Parse *pParse, void *pPtr){
|
||||
** with tail recursion in tokenExpr() routine, for a small performance
|
||||
** improvement.
|
||||
*/
|
||||
void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){
|
||||
const void *sqlite3RenameTokenMap(
|
||||
Parse *pParse,
|
||||
const void *pPtr,
|
||||
const Token *pToken
|
||||
){
|
||||
RenameToken *pNew;
|
||||
assert( pPtr || pParse->db->mallocFailed );
|
||||
renameTokenCheckAll(pParse, pPtr);
|
||||
@ -781,7 +785,7 @@ void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){
|
||||
** with parse tree element pFrom. This function remaps the associated token
|
||||
** to parse tree element pTo.
|
||||
*/
|
||||
void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFrom){
|
||||
void sqlite3RenameTokenRemap(Parse *pParse, const void *pTo, const void *pFrom){
|
||||
RenameToken *p;
|
||||
renameTokenCheckAll(pParse, pTo);
|
||||
for(p=pParse->pRename; p; p=p->pNext){
|
||||
@ -797,7 +801,7 @@ void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFrom){
|
||||
*/
|
||||
static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
|
||||
Parse *pParse = pWalker->pParse;
|
||||
sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
|
||||
sqlite3RenameTokenRemap(pParse, 0, (const void*)pExpr);
|
||||
return WRC_Continue;
|
||||
}
|
||||
|
||||
@ -841,12 +845,12 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){
|
||||
*/
|
||||
static void unmapColumnIdlistNames(
|
||||
Parse *pParse,
|
||||
IdList *pIdList
|
||||
const IdList *pIdList
|
||||
){
|
||||
if( pIdList ){
|
||||
int ii;
|
||||
for(ii=0; ii<pIdList->nId; ii++){
|
||||
sqlite3RenameTokenRemap(pParse, 0, (void*)pIdList->a[ii].zName);
|
||||
sqlite3RenameTokenRemap(pParse, 0, (const void*)pIdList->a[ii].zName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -943,7 +947,7 @@ static void renameTokenFree(sqlite3 *db, RenameToken *pToken){
|
||||
static RenameToken *renameTokenFind(
|
||||
Parse *pParse,
|
||||
struct RenameCtx *pCtx,
|
||||
void *pPtr
|
||||
const void *pPtr
|
||||
){
|
||||
RenameToken **pp;
|
||||
if( NEVER(pPtr==0) ){
|
||||
@ -1062,18 +1066,18 @@ static void renameColumnParseError(
|
||||
static void renameColumnElistNames(
|
||||
Parse *pParse,
|
||||
RenameCtx *pCtx,
|
||||
ExprList *pEList,
|
||||
const ExprList *pEList,
|
||||
const char *zOld
|
||||
){
|
||||
if( pEList ){
|
||||
int i;
|
||||
for(i=0; i<pEList->nExpr; i++){
|
||||
char *zName = pEList->a[i].zEName;
|
||||
const char *zName = pEList->a[i].zEName;
|
||||
if( ALWAYS(pEList->a[i].eEName==ENAME_NAME)
|
||||
&& ALWAYS(zName!=0)
|
||||
&& 0==sqlite3_stricmp(zName, zOld)
|
||||
){
|
||||
renameTokenFind(pParse, pCtx, (void*)zName);
|
||||
renameTokenFind(pParse, pCtx, (const void*)zName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1087,15 +1091,15 @@ static void renameColumnElistNames(
|
||||
static void renameColumnIdlistNames(
|
||||
Parse *pParse,
|
||||
RenameCtx *pCtx,
|
||||
IdList *pIdList,
|
||||
const IdList *pIdList,
|
||||
const char *zOld
|
||||
){
|
||||
if( pIdList ){
|
||||
int i;
|
||||
for(i=0; i<pIdList->nId; i++){
|
||||
char *zName = pIdList->a[i].zName;
|
||||
const char *zName = pIdList->a[i].zName;
|
||||
if( 0==sqlite3_stricmp(zName, zOld) ){
|
||||
renameTokenFind(pParse, pCtx, (void*)zName);
|
||||
renameTokenFind(pParse, pCtx, (const void*)zName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1795,7 +1799,7 @@ static void renameTableFunc(
|
||||
|
||||
static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){
|
||||
if( pExpr->op==TK_STRING && (pExpr->flags & EP_DblQuoted) ){
|
||||
renameTokenFind(pWalker->pParse, pWalker->u.pRename, (void*)pExpr);
|
||||
renameTokenFind(pWalker->pParse, pWalker->u.pRename, (const void*)pExpr);
|
||||
}
|
||||
return WRC_Continue;
|
||||
}
|
||||
@ -2065,7 +2069,7 @@ drop_column_done:
|
||||
** statement. Argument pSrc contains the possibly qualified name of the
|
||||
** table being edited, and token pName the name of the column to drop.
|
||||
*/
|
||||
void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *pName){
|
||||
void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const Token *pName){
|
||||
sqlite3 *db = pParse->db; /* Database handle */
|
||||
Table *pTab; /* Table to modify */
|
||||
int iDb; /* Index of db containing pTab in aDb[] */
|
||||
|
@ -888,10 +888,10 @@ void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){
|
||||
** are not \000 terminated and are not persistent. The returned string
|
||||
** is \000 terminated and is persistent.
|
||||
*/
|
||||
char *sqlite3NameFromToken(sqlite3 *db, Token *pName){
|
||||
char *sqlite3NameFromToken(sqlite3 *db, const Token *pName){
|
||||
char *zName;
|
||||
if( pName ){
|
||||
zName = sqlite3DbStrNDup(db, (char*)pName->z, pName->n);
|
||||
zName = sqlite3DbStrNDup(db, (const char*)pName->z, pName->n);
|
||||
sqlite3Dequote(zName);
|
||||
}else{
|
||||
zName = 0;
|
||||
|
67
src/expr.c
67
src/expr.c
@ -21,7 +21,7 @@ static int exprCodeVector(Parse *pParse, Expr *p, int *piToFree);
|
||||
/*
|
||||
** Return the affinity character for a single column of a table.
|
||||
*/
|
||||
char sqlite3TableColumnAffinity(Table *pTab, int iCol){
|
||||
char sqlite3TableColumnAffinity(const Table *pTab, int iCol){
|
||||
assert( iCol<pTab->nCol );
|
||||
return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER;
|
||||
}
|
||||
@ -92,7 +92,7 @@ char sqlite3ExprAffinity(const Expr *pExpr){
|
||||
** and the pExpr parameter is returned unchanged.
|
||||
*/
|
||||
Expr *sqlite3ExprAddCollateToken(
|
||||
Parse *pParse, /* Parsing context */
|
||||
const Parse *pParse, /* Parsing context */
|
||||
Expr *pExpr, /* Add the "COLLATE" clause to this expression */
|
||||
const Token *pCollName, /* Name of collating sequence */
|
||||
int dequote /* True to dequote pCollName */
|
||||
@ -107,7 +107,11 @@ Expr *sqlite3ExprAddCollateToken(
|
||||
}
|
||||
return pExpr;
|
||||
}
|
||||
Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){
|
||||
Expr *sqlite3ExprAddCollateString(
|
||||
const Parse *pParse, /* Parsing context */
|
||||
Expr *pExpr, /* Add the "COLLATE" clause to this expression */
|
||||
const char *zC /* The collating sequence name */
|
||||
){
|
||||
Token s;
|
||||
assert( zC!=0 );
|
||||
sqlite3TokenInit(&s, (char*)zC);
|
||||
@ -409,7 +413,7 @@ static int codeCompare(
|
||||
** But a TK_SELECT might be either a vector or a scalar. It is only
|
||||
** considered a vector if it has two or more result columns.
|
||||
*/
|
||||
int sqlite3ExprIsVector(Expr *pExpr){
|
||||
int sqlite3ExprIsVector(const Expr *pExpr){
|
||||
return sqlite3ExprVectorSize(pExpr)>1;
|
||||
}
|
||||
|
||||
@ -419,7 +423,7 @@ int sqlite3ExprIsVector(Expr *pExpr){
|
||||
** is a sub-select, return the number of columns in the sub-select. For
|
||||
** any other type of expression, return 1.
|
||||
*/
|
||||
int sqlite3ExprVectorSize(Expr *pExpr){
|
||||
int sqlite3ExprVectorSize(const Expr *pExpr){
|
||||
u8 op = pExpr->op;
|
||||
if( op==TK_REGISTER ) op = pExpr->op2;
|
||||
if( op==TK_VECTOR ){
|
||||
@ -707,14 +711,14 @@ int sqlite3ExprCheckHeight(Parse *pParse, int nHeight){
|
||||
** to by pnHeight, the second parameter, then set *pnHeight to that
|
||||
** value.
|
||||
*/
|
||||
static void heightOfExpr(Expr *p, int *pnHeight){
|
||||
static void heightOfExpr(const Expr *p, int *pnHeight){
|
||||
if( p ){
|
||||
if( p->nHeight>*pnHeight ){
|
||||
*pnHeight = p->nHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
static void heightOfExprList(ExprList *p, int *pnHeight){
|
||||
static void heightOfExprList(const ExprList *p, int *pnHeight){
|
||||
if( p ){
|
||||
int i;
|
||||
for(i=0; i<p->nExpr; i++){
|
||||
@ -722,8 +726,8 @@ static void heightOfExprList(ExprList *p, int *pnHeight){
|
||||
}
|
||||
}
|
||||
}
|
||||
static void heightOfSelect(Select *pSelect, int *pnHeight){
|
||||
Select *p;
|
||||
static void heightOfSelect(const Select *pSelect, int *pnHeight){
|
||||
const Select *p;
|
||||
for(p=pSelect; p; p=p->pPrior){
|
||||
heightOfExpr(p->pWhere, pnHeight);
|
||||
heightOfExpr(p->pHaving, pnHeight);
|
||||
@ -775,7 +779,7 @@ void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){
|
||||
** Return the maximum height of any expression tree referenced
|
||||
** by the select statement passed as an argument.
|
||||
*/
|
||||
int sqlite3SelectExprHeight(Select *p){
|
||||
int sqlite3SelectExprHeight(const Select *p){
|
||||
int nHeight = 0;
|
||||
heightOfSelect(p, &nHeight);
|
||||
return nHeight;
|
||||
@ -1028,7 +1032,7 @@ Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
|
||||
Expr *sqlite3ExprFunction(
|
||||
Parse *pParse, /* Parsing context */
|
||||
ExprList *pList, /* Argument list */
|
||||
Token *pToken, /* Name of the function */
|
||||
const Token *pToken, /* Name of the function */
|
||||
int eDistinct /* SF_Distinct or SF_ALL or 0 */
|
||||
){
|
||||
Expr *pNew;
|
||||
@ -1066,8 +1070,8 @@ Expr *sqlite3ExprFunction(
|
||||
*/
|
||||
void sqlite3ExprFunctionUsable(
|
||||
Parse *pParse, /* Parsing and code generating context */
|
||||
Expr *pExpr, /* The function invocation */
|
||||
FuncDef *pDef /* The function being invoked */
|
||||
const Expr *pExpr, /* The function invocation */
|
||||
const FuncDef *pDef /* The function being invoked */
|
||||
){
|
||||
assert( !IN_RENAME_OBJECT );
|
||||
assert( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 );
|
||||
@ -1247,7 +1251,7 @@ void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){
|
||||
** passed as the first argument. This is always one of EXPR_FULLSIZE,
|
||||
** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE.
|
||||
*/
|
||||
static int exprStructSize(Expr *p){
|
||||
static int exprStructSize(const Expr *p){
|
||||
if( ExprHasProperty(p, EP_TokenOnly) ) return EXPR_TOKENONLYSIZE;
|
||||
if( ExprHasProperty(p, EP_Reduced) ) return EXPR_REDUCEDSIZE;
|
||||
return EXPR_FULLSIZE;
|
||||
@ -1287,7 +1291,7 @@ static int exprStructSize(Expr *p){
|
||||
** of dupedExprStructSize() contain multiple assert() statements that attempt
|
||||
** to enforce this constraint.
|
||||
*/
|
||||
static int dupedExprStructSize(Expr *p, int flags){
|
||||
static int dupedExprStructSize(const Expr *p, int flags){
|
||||
int nSize;
|
||||
assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */
|
||||
assert( EXPR_FULLSIZE<=0xfff );
|
||||
@ -1318,7 +1322,7 @@ static int dupedExprStructSize(Expr *p, int flags){
|
||||
** of the Expr structure and a copy of the Expr.u.zToken string (if that
|
||||
** string is defined.)
|
||||
*/
|
||||
static int dupedExprNodeSize(Expr *p, int flags){
|
||||
static int dupedExprNodeSize(const Expr *p, int flags){
|
||||
int nByte = dupedExprStructSize(p, flags) & 0xfff;
|
||||
if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
|
||||
nByte += sqlite3Strlen30NN(p->u.zToken)+1;
|
||||
@ -1339,7 +1343,7 @@ static int dupedExprNodeSize(Expr *p, int flags){
|
||||
** and Expr.pRight variables (but not for any structures pointed to or
|
||||
** descended from the Expr.x.pList or Expr.x.pSelect variables).
|
||||
*/
|
||||
static int dupedExprSize(Expr *p, int flags){
|
||||
static int dupedExprSize(const Expr *p, int flags){
|
||||
int nByte = 0;
|
||||
if( p ){
|
||||
nByte = dupedExprNodeSize(p, flags);
|
||||
@ -1358,7 +1362,7 @@ static int dupedExprSize(Expr *p, int flags){
|
||||
** if any. Before returning, *pzBuffer is set to the first byte past the
|
||||
** portion of the buffer copied into by this function.
|
||||
*/
|
||||
static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){
|
||||
static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){
|
||||
Expr *pNew; /* Value to return */
|
||||
u8 *zAlloc; /* Memory space from which to build Expr object */
|
||||
u32 staticFlag; /* EP_Static if space not obtained from malloc */
|
||||
@ -1539,13 +1543,14 @@ static void gatherSelectWindows(Select *p){
|
||||
** truncated version of the usual Expr structure that will be stored as
|
||||
** part of the in-memory representation of the database schema.
|
||||
*/
|
||||
Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){
|
||||
Expr *sqlite3ExprDup(sqlite3 *db, const Expr *p, int flags){
|
||||
assert( flags==0 || flags==EXPRDUP_REDUCE );
|
||||
return p ? exprDup(db, p, flags, 0) : 0;
|
||||
}
|
||||
ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){
|
||||
ExprList *sqlite3ExprListDup(sqlite3 *db, const ExprList *p, int flags){
|
||||
ExprList *pNew;
|
||||
struct ExprList_item *pItem, *pOldItem;
|
||||
struct ExprList_item *pItem;
|
||||
const struct ExprList_item *pOldItem;
|
||||
int i;
|
||||
Expr *pPriorSelectColOld = 0;
|
||||
Expr *pPriorSelectColNew = 0;
|
||||
@ -1597,7 +1602,7 @@ ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){
|
||||
*/
|
||||
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \
|
||||
|| !defined(SQLITE_OMIT_SUBQUERY)
|
||||
SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){
|
||||
SrcList *sqlite3SrcListDup(sqlite3 *db, const SrcList *p, int flags){
|
||||
SrcList *pNew;
|
||||
int i;
|
||||
int nByte;
|
||||
@ -1609,7 +1614,7 @@ SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){
|
||||
pNew->nSrc = pNew->nAlloc = p->nSrc;
|
||||
for(i=0; i<p->nSrc; i++){
|
||||
SrcItem *pNewItem = &pNew->a[i];
|
||||
SrcItem *pOldItem = &p->a[i];
|
||||
const SrcItem *pOldItem = &p->a[i];
|
||||
Table *pTab;
|
||||
pNewItem->pSchema = pOldItem->pSchema;
|
||||
pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);
|
||||
@ -1641,7 +1646,7 @@ SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){
|
||||
}
|
||||
return pNew;
|
||||
}
|
||||
IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){
|
||||
IdList *sqlite3IdListDup(sqlite3 *db, const IdList *p){
|
||||
IdList *pNew;
|
||||
int i;
|
||||
assert( db!=0 );
|
||||
@ -1665,11 +1670,11 @@ IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){
|
||||
}
|
||||
return pNew;
|
||||
}
|
||||
Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){
|
||||
Select *sqlite3SelectDup(sqlite3 *db, const Select *pDup, int flags){
|
||||
Select *pRet = 0;
|
||||
Select *pNext = 0;
|
||||
Select **pp = &pRet;
|
||||
Select *p;
|
||||
const Select *p;
|
||||
|
||||
assert( db!=0 );
|
||||
for(p=pDup; p; p=p->pPrior){
|
||||
@ -1910,7 +1915,7 @@ void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder, int eNulls){
|
||||
void sqlite3ExprListSetName(
|
||||
Parse *pParse, /* Parsing context */
|
||||
ExprList *pList, /* List to which to add the span. */
|
||||
Token *pName, /* Name to be added */
|
||||
const Token *pName, /* Name to be added */
|
||||
int dequote /* True to cause the name to be dequoted */
|
||||
){
|
||||
assert( pList!=0 || pParse->db->mallocFailed!=0 );
|
||||
@ -1928,7 +1933,7 @@ void sqlite3ExprListSetName(
|
||||
** to the token-map. */
|
||||
sqlite3Dequote(pItem->zEName);
|
||||
if( IN_RENAME_OBJECT ){
|
||||
sqlite3RenameTokenMap(pParse, (void*)pItem->zEName, pName);
|
||||
sqlite3RenameTokenMap(pParse, (const void*)pItem->zEName, pName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2356,7 +2361,7 @@ int sqlite3ExprContainsSubquery(Expr *p){
|
||||
** in *pValue. If the expression is not an integer or if it is too big
|
||||
** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
|
||||
*/
|
||||
int sqlite3ExprIsInteger(Expr *p, int *pValue){
|
||||
int sqlite3ExprIsInteger(const Expr *p, int *pValue){
|
||||
int rc = 0;
|
||||
if( NEVER(p==0) ) return 0; /* Used to only happen following on OOM */
|
||||
|
||||
@ -2489,7 +2494,7 @@ int sqlite3IsRowid(const char *z){
|
||||
** table, then return NULL.
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_SUBQUERY
|
||||
static Select *isCandidateForInOpt(Expr *pX){
|
||||
static Select *isCandidateForInOpt(const Expr *pX){
|
||||
Select *p;
|
||||
SrcList *pSrc;
|
||||
ExprList *pEList;
|
||||
@ -2867,7 +2872,7 @@ int sqlite3FindInIndex(
|
||||
** It is the responsibility of the caller to ensure that the returned
|
||||
** string is eventually freed using sqlite3DbFree().
|
||||
*/
|
||||
static char *exprINAffinity(Parse *pParse, Expr *pExpr){
|
||||
static char *exprINAffinity(Parse *pParse, const Expr *pExpr){
|
||||
Expr *pLeft = pExpr->pLeft;
|
||||
int nVal = sqlite3ExprVectorSize(pLeft);
|
||||
Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0;
|
||||
|
12
src/malloc.c
12
src/malloc.c
@ -316,7 +316,7 @@ void *sqlite3_malloc64(sqlite3_uint64 n){
|
||||
** TRUE if p is a lookaside memory allocation from db
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_LOOKASIDE
|
||||
static int isLookaside(sqlite3 *db, void *p){
|
||||
static int isLookaside(sqlite3 *db, const void *p){
|
||||
return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pEnd);
|
||||
}
|
||||
#else
|
||||
@ -327,18 +327,18 @@ static int isLookaside(sqlite3 *db, void *p){
|
||||
** Return the size of a memory allocation previously obtained from
|
||||
** sqlite3Malloc() or sqlite3_malloc().
|
||||
*/
|
||||
int sqlite3MallocSize(void *p){
|
||||
int sqlite3MallocSize(const void *p){
|
||||
assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
|
||||
return sqlite3GlobalConfig.m.xSize(p);
|
||||
return sqlite3GlobalConfig.m.xSize((void*)p);
|
||||
}
|
||||
static int lookasideMallocSize(sqlite3 *db, void *p){
|
||||
static int lookasideMallocSize(sqlite3 *db, const void *p){
|
||||
#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
|
||||
return p<db->lookaside.pMiddle ? db->lookaside.szTrue : LOOKASIDE_SMALL;
|
||||
#else
|
||||
return db->lookaside.szTrue;
|
||||
#endif
|
||||
}
|
||||
int sqlite3DbMallocSize(sqlite3 *db, void *p){
|
||||
int sqlite3DbMallocSize(sqlite3 *db, const void *p){
|
||||
assert( p!=0 );
|
||||
#ifdef SQLITE_DEBUG
|
||||
if( db==0 || !isLookaside(db,p) ){
|
||||
@ -365,7 +365,7 @@ int sqlite3DbMallocSize(sqlite3 *db, void *p){
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlite3GlobalConfig.m.xSize(p);
|
||||
return sqlite3GlobalConfig.m.xSize((void*)p);
|
||||
}
|
||||
sqlite3_uint64 sqlite3_msize(void *p){
|
||||
assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
|
||||
|
@ -4242,8 +4242,8 @@ void *sqlite3DbReallocOrFree(sqlite3 *, void *, u64);
|
||||
void *sqlite3DbRealloc(sqlite3 *, void *, u64);
|
||||
void sqlite3DbFree(sqlite3*, void*);
|
||||
void sqlite3DbFreeNN(sqlite3*, void*);
|
||||
int sqlite3MallocSize(void*);
|
||||
int sqlite3DbMallocSize(sqlite3*, void*);
|
||||
int sqlite3MallocSize(const void*);
|
||||
int sqlite3DbMallocSize(sqlite3*, const void*);
|
||||
void *sqlite3PageMalloc(int);
|
||||
void sqlite3PageFree(void*);
|
||||
void sqlite3MemSetDefault(void);
|
||||
@ -4379,8 +4379,8 @@ Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
|
||||
void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
|
||||
Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
|
||||
Expr *sqlite3ExprSimplifiedAndOr(Expr*);
|
||||
Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
|
||||
void sqlite3ExprFunctionUsable(Parse*,Expr*,FuncDef*);
|
||||
Expr *sqlite3ExprFunction(Parse*,ExprList*, const Token*, int);
|
||||
void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*);
|
||||
void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
|
||||
void sqlite3ExprDelete(sqlite3*, Expr*);
|
||||
void sqlite3ExprDeferredDelete(Parse*, Expr*);
|
||||
@ -4389,7 +4389,7 @@ ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
|
||||
ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
|
||||
Select *sqlite3ExprListToValues(Parse*, int, ExprList*);
|
||||
void sqlite3ExprListSetSortOrder(ExprList*,int,int);
|
||||
void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);
|
||||
void sqlite3ExprListSetName(Parse*,ExprList*,const Token*,int);
|
||||
void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*);
|
||||
void sqlite3ExprListDelete(sqlite3*, ExprList*);
|
||||
u32 sqlite3ExprListFlags(const ExprList*);
|
||||
@ -4572,7 +4572,7 @@ void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
|
||||
void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
|
||||
void sqlite3Vacuum(Parse*,Token*,Expr*);
|
||||
int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*);
|
||||
char *sqlite3NameFromToken(sqlite3*, Token*);
|
||||
char *sqlite3NameFromToken(sqlite3*, const Token*);
|
||||
int sqlite3ExprCompare(Parse*,Expr*, Expr*, int);
|
||||
int sqlite3ExprCompareSkip(Expr*, Expr*, int);
|
||||
int sqlite3ExprListCompare(ExprList*, ExprList*, int);
|
||||
@ -4607,7 +4607,7 @@ int sqlite3ExprIsTableConstant(Expr*,int);
|
||||
#ifdef SQLITE_ENABLE_CURSOR_HINTS
|
||||
int sqlite3ExprContainsSubquery(Expr*);
|
||||
#endif
|
||||
int sqlite3ExprIsInteger(Expr*, int*);
|
||||
int sqlite3ExprIsInteger(const Expr*, int*);
|
||||
int sqlite3ExprCanBeNull(const Expr*);
|
||||
int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);
|
||||
int sqlite3IsRowid(const char*);
|
||||
@ -4632,11 +4632,11 @@ void sqlite3MayAbort(Parse*);
|
||||
void sqlite3HaltConstraint(Parse*, int, int, char*, i8, u8);
|
||||
void sqlite3UniqueConstraint(Parse*, int, Index*);
|
||||
void sqlite3RowidConstraint(Parse*, int, Table*);
|
||||
Expr *sqlite3ExprDup(sqlite3*,Expr*,int);
|
||||
ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int);
|
||||
SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int);
|
||||
IdList *sqlite3IdListDup(sqlite3*,IdList*);
|
||||
Select *sqlite3SelectDup(sqlite3*,Select*,int);
|
||||
Expr *sqlite3ExprDup(sqlite3*,const Expr*,int);
|
||||
ExprList *sqlite3ExprListDup(sqlite3*,const ExprList*,int);
|
||||
SrcList *sqlite3SrcListDup(sqlite3*,const SrcList*,int);
|
||||
IdList *sqlite3IdListDup(sqlite3*,const IdList*);
|
||||
Select *sqlite3SelectDup(sqlite3*,const Select*,int);
|
||||
FuncDef *sqlite3FunctionSearch(int,const char*);
|
||||
void sqlite3InsertBuiltinFuncs(FuncDef*,int);
|
||||
FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8);
|
||||
@ -4774,7 +4774,7 @@ const char *sqlite3IndexAffinityStr(sqlite3*, Index*);
|
||||
void sqlite3TableAffinity(Vdbe*, Table*, int);
|
||||
char sqlite3CompareAffinity(const Expr *pExpr, char aff2);
|
||||
int sqlite3IndexAffinityOk(const Expr *pExpr, char idx_affinity);
|
||||
char sqlite3TableColumnAffinity(Table*,int);
|
||||
char sqlite3TableColumnAffinity(const Table*,int);
|
||||
char sqlite3ExprAffinity(const Expr *pExpr);
|
||||
int sqlite3Atoi64(const char*, i64*, int, u8);
|
||||
int sqlite3DecOrHexToI64(const char*, i64*);
|
||||
@ -4803,8 +4803,8 @@ void sqlite3SetTextEncoding(sqlite3 *db, u8);
|
||||
CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr);
|
||||
CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, const Expr *pExpr);
|
||||
int sqlite3ExprCollSeqMatch(Parse*,const Expr*,const Expr*);
|
||||
Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);
|
||||
Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*);
|
||||
Expr *sqlite3ExprAddCollateToken(const Parse *pParse, Expr*, const Token*, int);
|
||||
Expr *sqlite3ExprAddCollateString(const Parse*,Expr*,const char*);
|
||||
Expr *sqlite3ExprSkipCollate(Expr*);
|
||||
Expr *sqlite3ExprSkipCollateAndLikely(Expr*);
|
||||
int sqlite3CheckCollSeq(Parse *, CollSeq *);
|
||||
@ -4887,9 +4887,9 @@ int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
|
||||
void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
|
||||
void sqlite3AlterFinishAddColumn(Parse *, Token *);
|
||||
void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
|
||||
void sqlite3AlterDropColumn(Parse*, SrcList*, Token*);
|
||||
void *sqlite3RenameTokenMap(Parse*, void*, Token*);
|
||||
void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
|
||||
void sqlite3AlterDropColumn(Parse*, SrcList*, const Token*);
|
||||
const void *sqlite3RenameTokenMap(Parse*, const void*, const Token*);
|
||||
void sqlite3RenameTokenRemap(Parse*, const void *pTo, const void *pFrom);
|
||||
void sqlite3RenameExprUnmap(Parse*, Expr*);
|
||||
void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
|
||||
CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
|
||||
@ -5164,7 +5164,7 @@ void sqlite3MemJournalOpen(sqlite3_file *);
|
||||
|
||||
void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p);
|
||||
#if SQLITE_MAX_EXPR_DEPTH>0
|
||||
int sqlite3SelectExprHeight(Select *);
|
||||
int sqlite3SelectExprHeight(const Select *);
|
||||
int sqlite3ExprCheckHeight(Parse*, int);
|
||||
#else
|
||||
#define sqlite3SelectExprHeight(x) 0
|
||||
@ -5261,8 +5261,8 @@ int sqlite3DbpageRegister(sqlite3*);
|
||||
int sqlite3DbstatRegister(sqlite3*);
|
||||
#endif
|
||||
|
||||
int sqlite3ExprVectorSize(Expr *pExpr);
|
||||
int sqlite3ExprIsVector(Expr *pExpr);
|
||||
int sqlite3ExprVectorSize(const Expr *pExpr);
|
||||
int sqlite3ExprIsVector(const Expr *pExpr);
|
||||
Expr *sqlite3VectorFieldSubexpr(Expr*, int);
|
||||
Expr *sqlite3ExprForVectorField(Parse*,Expr*,int,int);
|
||||
void sqlite3VectorErrorMsg(Parse*, Expr*);
|
||||
|
Loading…
Reference in New Issue
Block a user