aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-06-11 10:43:56 +0000
committerdrh <drh@noemail.net>2019-06-11 10:43:56 +0000
commit8e34e4061b534130bc7495c102120371c8738d95 (patch)
tree54e870823fd3bfd69c70ba1071e4ff484a99e702 /src/expr.c
parentb854b767330306ae20b235186af8e75f3c368900 (diff)
downloadsqlite-8e34e4061b534130bc7495c102120371c8738d95.tar.gz
sqlite-8e34e4061b534130bc7495c102120371c8738d95.zip
Add the new sqlite3ExprUnmapAndDelete() function and use it in place of
separate calls to sqlite3RenameExprUnmap() and sqlite3ExprDelete(). FossilOrigin-Name: 36ea13e0a851a749c9ef292377ecd82dbd4797d38df907b362487fa234c98ca5
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/expr.c b/src/expr.c
index 057cbd6b7..4e8251bd8 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -895,12 +895,8 @@ Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
}else if( pRight==0 ){
return pLeft;
}else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){
- if( IN_RENAME_OBJECT ){
- sqlite3RenameExprUnmap(pParse, pLeft);
- sqlite3RenameExprUnmap(pParse, pRight);
- }
- sqlite3ExprDelete(db, pLeft);
- sqlite3ExprDelete(db, pRight);
+ sqlite3ExprUnmapAndDelete(pParse, pLeft);
+ sqlite3ExprUnmapAndDelete(pParse, pRight);
return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);
}else{
return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
@@ -1060,6 +1056,18 @@ void sqlite3ExprDelete(sqlite3 *db, Expr *p){
if( p ) sqlite3ExprDeleteNN(db, p);
}
+/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the
+** expression.
+*/
+void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){
+ if( p ){
+ if( IN_RENAME_OBJECT ){
+ sqlite3RenameExprUnmap(pParse, p);
+ }
+ sqlite3ExprDeleteNN(pParse->db, p);
+ }
+}
+
/*
** Return the number of bytes allocated for the expression structure
** passed as the first argument. This is always one of EXPR_FULLSIZE,
@@ -1642,10 +1650,7 @@ ExprList *sqlite3ExprListAppendVector(
}
vector_append_error:
- if( IN_RENAME_OBJECT ){
- sqlite3RenameExprUnmap(pParse, pExpr);
- }
- sqlite3ExprDelete(db, pExpr);
+ sqlite3ExprUnmapAndDelete(pParse, pExpr);
sqlite3IdListDelete(db, pColumns);
return pList;
}