mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Add the new internal interface sqlite3DbNNFreeNN(db,ptr) where both the
db and ptr parameters are guaranteed to be non-NULL. Use this where appropriate to save more than 2 million CPU cycles on the standard performance test. FossilOrigin-Name: e5eaa80e81fdf86f2875a912b880272b8d099b82b08e945a7988c5dd0fe9d6b5
This commit is contained in:
11
src/expr.c
11
src/expr.c
@@ -1220,6 +1220,7 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){
|
||||
*/
|
||||
static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
|
||||
assert( p!=0 );
|
||||
assert( db!=0 );
|
||||
assert( !ExprUseUValue(p) || p->u.iValue>=0 );
|
||||
assert( !ExprUseYWin(p) || !ExprUseYSub(p) );
|
||||
assert( !ExprUseYWin(p) || p->y.pWin!=0 || db->mallocFailed );
|
||||
@@ -1252,7 +1253,7 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
|
||||
}
|
||||
}
|
||||
if( !ExprHasProperty(p, EP_Static) ){
|
||||
sqlite3DbFreeNN(db, p);
|
||||
sqlite3DbNNFreeNN(db, p);
|
||||
}
|
||||
}
|
||||
void sqlite3ExprDelete(sqlite3 *db, Expr *p){
|
||||
@@ -2038,12 +2039,13 @@ static SQLITE_NOINLINE void exprListDeleteNN(sqlite3 *db, ExprList *pList){
|
||||
int i = pList->nExpr;
|
||||
struct ExprList_item *pItem = pList->a;
|
||||
assert( pList->nExpr>0 );
|
||||
assert( db!=0 );
|
||||
do{
|
||||
sqlite3ExprDelete(db, pItem->pExpr);
|
||||
sqlite3DbFree(db, pItem->zEName);
|
||||
if( pItem->zEName ) sqlite3DbNNFreeNN(db, pItem->zEName);
|
||||
pItem++;
|
||||
}while( --i>0 );
|
||||
sqlite3DbFreeNN(db, pList);
|
||||
sqlite3DbNNFreeNN(db, pList);
|
||||
}
|
||||
void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
|
||||
if( pList ) exprListDeleteNN(db, pList);
|
||||
@@ -6075,6 +6077,7 @@ static int exprRefToSrcList(Walker *pWalker, Expr *pExpr){
|
||||
int sqlite3ReferencesSrcList(Parse *pParse, Expr *pExpr, SrcList *pSrcList){
|
||||
Walker w;
|
||||
struct RefSrcList x;
|
||||
assert( pParse->db!=0 );
|
||||
memset(&w, 0, sizeof(w));
|
||||
memset(&x, 0, sizeof(x));
|
||||
w.xExprCallback = exprRefToSrcList;
|
||||
@@ -6091,7 +6094,7 @@ int sqlite3ReferencesSrcList(Parse *pParse, Expr *pExpr, SrcList *pSrcList){
|
||||
sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter);
|
||||
}
|
||||
#endif
|
||||
sqlite3DbFree(pParse->db, x.aiExclude);
|
||||
if( x.aiExclude ) sqlite3DbNNFreeNN(pParse->db, x.aiExclude);
|
||||
if( w.eCode & 0x01 ){
|
||||
return 1;
|
||||
}else if( w.eCode ){
|
||||
|
Reference in New Issue
Block a user