aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2021-09-25 17:07:57 +0000
committerdrh <>2021-09-25 17:07:57 +0000
commit1580d50b7657a8e97550f2ad8d162c937a28897e (patch)
tree665c6ade2c0d8b82e295a865898318861b6efe14 /src
parent84d90319e585173a50ac157d9404aee7d6261fe3 (diff)
downloadsqlite-1580d50b7657a8e97550f2ad8d162c937a28897e.tar.gz
sqlite-1580d50b7657a8e97550f2ad8d162c937a28897e.zip
Add const to parameters on various internal interfaces.
FossilOrigin-Name: 70c221c5cf7b4d9ed34f16d045f262f99d16aa3db84f80cf0b03ee82ba28d075
Diffstat (limited to 'src')
-rw-r--r--src/expr.c30
-rw-r--r--src/sqliteInt.h12
-rw-r--r--src/vdbemem.c6
-rw-r--r--src/window.c7
4 files changed, 37 insertions, 18 deletions
diff --git a/src/expr.c b/src/expr.c
index 09fe66b7f..baa1fce3d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -5329,7 +5329,11 @@ void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,int jumpIfNull){
** Otherwise, if the values are not the same or if pExpr is not a simple
** SQL value, zero is returned.
*/
-static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){
+static int exprCompareVariable(
+ const Parse *pParse,
+ const Expr *pVar,
+ const Expr *pExpr
+){
int res = 0;
int iVar;
sqlite3_value *pL, *pR = 0;
@@ -5381,7 +5385,12 @@ static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){
** Argument pParse should normally be NULL. If it is not NULL and pA or
** pB causes a return value of 2.
*/
-int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){
+int sqlite3ExprCompare(
+ const Parse *pParse,
+ const Expr *pA,
+ const Expr *pB,
+ int iTab
+){
u32 combinedFlags;
if( pA==0 || pB==0 ){
return pB==pA ? 0 : 2;
@@ -5465,7 +5474,7 @@ int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){
** Two NULL pointers are considered to be the same. But a NULL pointer
** always differs from a non-NULL pointer.
*/
-int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){
+int sqlite3ExprListCompare(const ExprList *pA, const ExprList *pB, int iTab){
int i;
if( pA==0 && pB==0 ) return 0;
if( pA==0 || pB==0 ) return 1;
@@ -5484,7 +5493,7 @@ int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){
** Like sqlite3ExprCompare() except COLLATE operators at the top-level
** are ignored.
*/
-int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
+int sqlite3ExprCompareSkip(Expr *pA,Expr *pB, int iTab){
return sqlite3ExprCompare(0,
sqlite3ExprSkipCollateAndLikely(pA),
sqlite3ExprSkipCollateAndLikely(pB),
@@ -5498,9 +5507,9 @@ int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
** non-NULL if pNN is not NULL
*/
static int exprImpliesNotNull(
- Parse *pParse, /* Parsing context */
- Expr *p, /* The expression to be checked */
- Expr *pNN, /* The expression that is NOT NULL */
+ const Parse *pParse,/* Parsing context */
+ const Expr *p, /* The expression to be checked */
+ const Expr *pNN, /* The expression that is NOT NULL */
int iTab, /* Table being evaluated */
int seenNot /* Return true only if p can be any non-NULL value */
){
@@ -5593,7 +5602,12 @@ static int exprImpliesNotNull(
** improvement. Returning false might cause a performance reduction, but
** it will always give the correct answer and is hence always safe.
*/
-int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){
+int sqlite3ExprImpliesExpr(
+ const Parse *pParse,
+ const Expr *pE1,
+ const Expr *pE2,
+ int iTab
+){
if( sqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){
return 1;
}
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 82f2803d6..21682fa11 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -4110,7 +4110,7 @@ void sqlite3WindowListDelete(sqlite3 *db, Window *p);
Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*, u8);
void sqlite3WindowAttach(Parse*, Expr*, Window*);
void sqlite3WindowLink(Select *pSel, Window *pWin);
-int sqlite3WindowCompare(Parse*, Window*, Window*, int);
+int sqlite3WindowCompare(const Parse*, const Window*, const Window*, int);
void sqlite3WindowCodeInit(Parse*, Select*);
void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int);
int sqlite3WindowRewrite(Parse*, Select*);
@@ -4573,10 +4573,10 @@ void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
void sqlite3Vacuum(Parse*,Token*,Expr*);
int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*);
char *sqlite3NameFromToken(sqlite3*, const Token*);
-int sqlite3ExprCompare(Parse*,Expr*, Expr*, int);
-int sqlite3ExprCompareSkip(Expr*, Expr*, int);
-int sqlite3ExprListCompare(ExprList*, ExprList*, int);
-int sqlite3ExprImpliesExpr(Parse*,Expr*, Expr*, int);
+int sqlite3ExprCompare(const Parse*,const Expr*,const Expr*, int);
+int sqlite3ExprCompareSkip(Expr*,Expr*,int);
+int sqlite3ExprListCompare(const ExprList*,const ExprList*, int);
+int sqlite3ExprImpliesExpr(const Parse*,const Expr*,const Expr*, int);
int sqlite3ExprImpliesNonNullRow(Expr*,int);
void sqlite3AggInfoPersistWalkerInit(Walker*,Parse*);
void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
@@ -4835,7 +4835,7 @@ sqlite3_value *sqlite3ValueNew(sqlite3 *);
#ifndef SQLITE_OMIT_UTF16
char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
#endif
-int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
+int sqlite3ValueFromExpr(sqlite3 *, const Expr *, u8, u8, sqlite3_value **);
void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
#ifndef SQLITE_AMALGAMATION
extern const unsigned char sqlite3OpcodeProperty[];
diff --git a/src/vdbemem.c b/src/vdbemem.c
index dc177161b..e67cd6412 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -1388,7 +1388,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
#ifdef SQLITE_ENABLE_STAT4
static int valueFromFunction(
sqlite3 *db, /* The database connection */
- Expr *p, /* The expression to evaluate */
+ const Expr *p, /* The expression to evaluate */
u8 enc, /* Encoding to use */
u8 aff, /* Affinity to use */
sqlite3_value **ppVal, /* Write the new value here */
@@ -1482,7 +1482,7 @@ static int valueFromFunction(
*/
static int valueFromExpr(
sqlite3 *db, /* The database connection */
- Expr *pExpr, /* The expression to evaluate */
+ const Expr *pExpr, /* The expression to evaluate */
u8 enc, /* Encoding to use */
u8 affinity, /* Affinity to use */
sqlite3_value **ppVal, /* Write the new value here */
@@ -1637,7 +1637,7 @@ no_mem:
*/
int sqlite3ValueFromExpr(
sqlite3 *db, /* The database connection */
- Expr *pExpr, /* The expression to evaluate */
+ const Expr *pExpr, /* The expression to evaluate */
u8 enc, /* Encoding to use */
u8 affinity, /* Affinity to use */
sqlite3_value **ppVal /* Write the new value here */
diff --git a/src/window.c b/src/window.c
index 423ad2db8..ba0e14e00 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1345,7 +1345,12 @@ void sqlite3WindowLink(Select *pSel, Window *pWin){
** different, or 2 if it cannot be determined if the objects are identical
** or not. Identical window objects can be processed in a single scan.
*/
-int sqlite3WindowCompare(Parse *pParse, Window *p1, Window *p2, int bFilter){
+int sqlite3WindowCompare(
+ const Parse *pParse,
+ const Window *p1,
+ const Window *p2,
+ int bFilter
+){
int res;
if( NEVER(p1==0) || NEVER(p2==0) ) return 1;
if( p1->eFrmType!=p2->eFrmType ) return 1;