Remove dead code identified by the clang static analyzer.
FossilOrigin-Name: 01a79d5a7af48fb7e50291c0c7c6283d3fb359d0
diff --git a/src/btree.c b/src/btree.c
index f5960da..fa0889a 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -6179,9 +6179,7 @@
}
}
if( minI>i ){
- int t;
MemPage *pT;
- t = apNew[i]->pgno;
pT = apNew[i];
apNew[i] = apNew[minI];
apNew[minI] = pT;
diff --git a/src/fkey.c b/src/fkey.c
index a385b81..653cc18 100644
--- a/src/fkey.c
+++ b/src/fkey.c
@@ -687,7 +687,6 @@
int regNew /* New row data is stored here */
){
sqlite3 *db = pParse->db; /* Database handle */
- Vdbe *v; /* VM to write code to */
FKey *pFKey; /* Used to iterate through FKs */
int iDb; /* Index of database containing pTab */
const char *zDb; /* Name of database containing pTab */
@@ -699,7 +698,6 @@
/* If foreign-keys are disabled, this function is a no-op. */
if( (db->flags&SQLITE_ForeignKeys)==0 ) return;
- v = sqlite3GetVdbe(pParse);
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
zDb = db->aDb[iDb].zName;
diff --git a/src/insert.c b/src/insert.c
index adf6ef2..851f778 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -465,7 +465,6 @@
int regIns; /* Block of regs holding rowid+data being inserted */
int regRowid; /* registers holding insert rowid */
int regData; /* register holding first column to insert */
- int regRecord; /* Holds the assemblied row record */
int regEof = 0; /* Register recording end of SELECT data */
int *aRegIdx = 0; /* One register allocated to each index */
@@ -794,7 +793,6 @@
/* Allocate registers for holding the rowid of the new row,
** the content of the new row, and the assemblied row record.
*/
- regRecord = ++pParse->nMem;
regRowid = regIns = pParse->nMem+1;
pParse->nMem += pTab->nCol + 1;
if( IsVirtual(pTab) ){
@@ -1188,7 +1186,7 @@
case OE_Rollback:
case OE_Fail: {
char *zMsg;
- j1 = sqlite3VdbeAddOp3(v, OP_HaltIfNull,
+ sqlite3VdbeAddOp3(v, OP_HaltIfNull,
SQLITE_CONSTRAINT, onError, regData+i);
zMsg = sqlite3MPrintf(pParse->db, "%s.%s may not be NULL",
pTab->zName, pTab->aCol[i].zName);
diff --git a/src/prepare.c b/src/prepare.c
index 62a33b6..d778b8b 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -141,7 +141,7 @@
int meta[5];
InitData initData;
char const *zMasterSchema;
- char const *zMasterName = SCHEMA_TABLE(iDb);
+ char const *zMasterName;
int openedTransaction = 0;
/*
diff --git a/src/trigger.c b/src/trigger.c
index b1d43d0..ba8d47b 100644
--- a/src/trigger.c
+++ b/src/trigger.c
@@ -262,7 +262,6 @@
int iDb; /* Database containing the trigger */
Token nameToken; /* Trigger name for error reporting */
- pTrig = pParse->pNewTrigger;
pParse->pNewTrigger = 0;
if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup;
zName = pTrig->zName;
diff --git a/src/update.c b/src/update.c
index 045b4d1..315034d 100644
--- a/src/update.c
+++ b/src/update.c
@@ -128,7 +128,6 @@
int regNew;
int regOld = 0;
int regRowSet = 0; /* Rowset of rows to be updated */
- int regRec; /* Register used for new table record to insert */
memset(&sContext, 0, sizeof(sContext));
db = pParse->db;
@@ -286,7 +285,6 @@
}
regNew = pParse->nMem + 1;
pParse->nMem += pTab->nCol;
- regRec = ++pParse->nMem;
/* Start the view context. */
if( isView ){
diff --git a/src/vdbe.c b/src/vdbe.c
index 823688e..828baa5 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -2429,7 +2429,6 @@
*/
nData = 0; /* Number of bytes of data space */
nHdr = 0; /* Number of bytes of header space */
- nByte = 0; /* Data space required for this record */
nZero = 0; /* Number of zero bytes at the end of the record */
nField = pOp->p1;
zAffinity = pOp->p4.z;
@@ -3703,7 +3702,6 @@
** and try again, up to 100 times.
*/
assert( pC->isTable );
- cnt = 0;
#ifdef SQLITE_32BIT_ROWID
# define MAX_ROWID 0x7fffffff
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index 5578b86..76cd921 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -682,13 +682,11 @@
*/
static Mem *columnMem(sqlite3_stmt *pStmt, int i){
Vdbe *pVm;
- int vals;
Mem *pOut;
pVm = (Vdbe *)pStmt;
if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){
sqlite3_mutex_enter(pVm->db->mutex);
- vals = sqlite3_data_count(pStmt);
pOut = &pVm->pResultSet[i];
}else{
/* If the value passed as the second argument is out of range, return
diff --git a/src/wal.c b/src/wal.c
index 9f7545b..51ea18f 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1649,7 +1649,6 @@
}
assert( pIter );
- mxPage = pWal->hdr.nPage;
if( eMode!=SQLITE_CHECKPOINT_PASSIVE ) xBusy = xBusyCall;
/* Compute in mxSafeFrame the index of the last frame of the WAL that is
diff --git a/src/where.c b/src/where.c
index 727abdf..72529dd 100644
--- a/src/where.c
+++ b/src/where.c
@@ -4047,7 +4047,6 @@
**
*/
WhereClause *pOrWc; /* The OR-clause broken out into subterms */
- WhereTerm *pFinal; /* Final subterm within the OR-clause. */
SrcList *pOrTab; /* Shortened table list or OR-clause generation */
int regReturn = ++pParse->nMem; /* Register used with OP_Gosub */
@@ -4063,7 +4062,6 @@
assert( pTerm->eOperator==WO_OR );
assert( (pTerm->wtFlags & TERM_ORINFO)!=0 );
pOrWc = &pTerm->u.pOrInfo->wc;
- pFinal = &pOrWc->a[pOrWc->nTerm-1];
pLevel->op = OP_Return;
pLevel->p1 = regReturn;
@@ -4172,7 +4170,6 @@
** the use of indices become tests that are evaluated against each row of
** the relevant input tables.
*/
- k = 0;
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
Expr *pE;
testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* IMP: R-30575-11662 */
@@ -4190,7 +4187,6 @@
continue;
}
sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
- k = 1;
pTerm->wtFlags |= TERM_CODED;
}
@@ -4498,8 +4494,6 @@
** clause.
*/
notReady = ~(Bitmask)0;
- pTabItem = pTabList->a;
- pLevel = pWInfo->a;
andFlags = ~0;
WHERETRACE(("*** Optimizer Start ***\n"));
for(i=iFrom=0, pLevel=pWInfo->a; i<nTabList; i++, pLevel++){