1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Simplifications to the preupdate_hook logic to make it easier to reason about,

and reduce static analyzer warnings.

FossilOrigin-Name: 91e3b98e06feaa5b70caf2266200d20d0ae4e432db147975c9f5959f93df7e7b
This commit is contained in:
drh
2021-10-05 11:11:43 +00:00
parent 7d4c94bc0f
commit e1e1a43a0f
3 changed files with 12 additions and 11 deletions

View File

@@ -5256,7 +5256,7 @@ case OP_Insert: {
assert( (pOp->p5 & OPFLAG_ISNOOP) || HasRowid(pTab) );
}else{
pTab = 0;
zDb = 0; /* Not needed. Silence a compiler warning. */
zDb = 0;
}
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
@@ -5409,13 +5409,14 @@ case OP_Delete: {
pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor);
}
}else{
zDb = 0; /* Not needed. Silence a compiler warning. */
pTab = 0; /* Not needed. Silence a compiler warning. */
zDb = 0;
pTab = 0;
}
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
/* Invoke the pre-update-hook if required. */
if( db->xPreUpdateCallback && pOp->p4.pTab ){
assert( db->xPreUpdateCallback==0 || pTab==pOp->p4.pTab );
if( db->xPreUpdateCallback && pTab ){
assert( !(opflags & OPFLAG_ISUPDATE)
|| HasRowid(pTab)==0
|| (aMem[pOp->p3].flags & MEM_Int)