Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org,
	Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v7 4/7] sql: rename sql_expr_free to sql_expr_delete
Date: Wed, 23 May 2018 17:05:31 +0300	[thread overview]
Message-ID: <19aefd955a44af24ae84d2e07ace6921e41d991d.1527084287.git.kshcherbatov@tarantool.org> (raw)
In-Reply-To: <cover.1527084286.git.kshcherbatov@tarantool.org>
In-Reply-To: <cover.1527084286.git.kshcherbatov@tarantool.org>

According our convention resource release functions should
have _delete but not _free suffix.

Part of #3272.
---
 src/box/space_def.c     |  4 ++--
 src/box/sql.h           |  2 +-
 src/box/sql/build.c     | 12 ++++++------
 src/box/sql/delete.c    |  2 +-
 src/box/sql/expr.c      | 26 +++++++++++++-------------
 src/box/sql/fkey.c      | 10 +++++-----
 src/box/sql/parse.y     | 22 +++++++++++-----------
 src/box/sql/resolve.c   | 12 ++++++------
 src/box/sql/select.c    | 18 +++++++++---------
 src/box/sql/trigger.c   | 12 ++++++------
 src/box/sql/update.c    |  2 +-
 src/box/sql/wherecode.c |  2 +-
 src/box/sql/whereexpr.c |  6 +++---
 13 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/src/box/space_def.c b/src/box/space_def.c
index 2f0a9f0..9e0e7e3 100644
--- a/src/box/space_def.c
+++ b/src/box/space_def.c
@@ -216,8 +216,8 @@ space_def_destroy_fields(struct field_def *fields, uint32_t field_count)
 {
 	for (uint32_t i = 0; i < field_count; ++i) {
 		if (fields[i].default_value_expr != NULL) {
-			sql_expr_free(sql_get(), fields[i].default_value_expr,
-				      true);
+			sql_expr_delete(sql_get(), fields[i].default_value_expr,
+					true);
 		}
 	}
 }
diff --git a/src/box/sql.h b/src/box/sql.h
index a7f2500..20f0651 100644
--- a/src/box/sql.h
+++ b/src/box/sql.h
@@ -144,7 +144,7 @@ sql_expr_dup(struct sqlite3 *db, struct Expr *p, int flags, char **buffer);
  * @param extern_alloc True if skeleton was allocated externally.
  */
 void
-sql_expr_free(struct sqlite3 *db, struct Expr *expr, bool extern_alloc);
+sql_expr_delete(struct sqlite3 *db, struct Expr *expr, bool extern_alloc);
 
 /**
  * Create and initialize a new ephemeral SQL Table object.
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index e376295..a6ddcf0 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -251,7 +251,7 @@ sqlite3LocateIndex(sqlite3 * db, const char *zName, const char *zTable)
 static void
 freeIndex(sqlite3 * db, Index * p)
 {
-	sql_expr_free(db, p->pPartIdxWhere, false);
+	sql_expr_delete(db, p->pPartIdxWhere, false);
 	sqlite3ExprListDelete(db, p->aColExpr);
 	sqlite3DbFree(db, p->zColAff);
 	sqlite3DbFree(db, p);
@@ -923,7 +923,7 @@ sqlite3AddDefaultValue(Parse * pParse, ExprSpan * pSpan)
 			field->default_value[default_length] = '\0';
 		}
 	}
-	sql_expr_free(db, pSpan->pExpr, false);
+	sql_expr_delete(db, pSpan->pExpr, false);
 }
 
 
@@ -1038,7 +1038,7 @@ sqlite3AddCheckConstraint(Parse * pParse,	/* Parsing context */
 		}
 	} else
 #endif
-		sql_expr_free(pParse->db, pCheckExpr, false);
+		sql_expr_delete(pParse->db, pCheckExpr, false);
 }
 
 /*
@@ -3239,7 +3239,7 @@ sql_create_index(struct Parse *parse, struct Token *token,
  exit_create_index:
 	if (pIndex)
 		freeIndex(db, pIndex);
-	sql_expr_free(db, where, false);
+	sql_expr_delete(db, where, false);
 	sqlite3ExprListDelete(db, col_list);
 	sqlite3SrcListDelete(db, tbl_name);
 	sqlite3DbFree(db, zName);
@@ -3655,7 +3655,7 @@ sqlite3SrcListDelete(sqlite3 * db, SrcList * pList)
 			sqlite3ExprListDelete(db, pItem->u1.pFuncArg);
 		sqlite3DeleteTable(db, pItem->pTab);
 		sqlite3SelectDelete(db, pItem->pSelect);
-		sql_expr_free(db, pItem->pOn, false);
+		sql_expr_delete(db, pItem->pOn, false);
 		sqlite3IdListDelete(db, pItem->pUsing);
 	}
 	sqlite3DbFree(db, pList);
@@ -3711,7 +3711,7 @@ sqlite3SrcListAppendFromTerm(Parse * pParse,	/* Parsing context */
 
  append_from_error:
 	assert(p == 0);
-	sql_expr_free(db, pOn, false);
+	sql_expr_delete(db, pOn, false);
 	sqlite3IdListDelete(db, pUsing);
 	sqlite3SelectDelete(db, pSubquery);
 	return 0;
diff --git a/src/box/sql/delete.c b/src/box/sql/delete.c
index 5572763..ddad54b 100644
--- a/src/box/sql/delete.c
+++ b/src/box/sql/delete.c
@@ -391,7 +391,7 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
 
  delete_from_cleanup:
 	sqlite3SrcListDelete(db, tab_list);
-	sql_expr_free(db, where, false);
+	sql_expr_delete(db, where, false);
 }
 
 void
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index 8259680..64991ee 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -464,7 +464,7 @@ sqlite3ExprForVectorField(Parse * pParse,	/* Parsing context */
 		 * pLeft->iTable:   First in an array of register holding result, or 0
 		 *                  if the result is not yet computed.
 		 *
-		 * sql_expr_free() specifically skips the recursive delete of
+		 * sql_expr_delete() specifically skips the recursive delete of
 		 * pLeft on TK_SELECT_COLUMN nodes.  But pRight is followed, so pVector
 		 * can be attached to pRight to cause this node to take ownership of
 		 * pVector.  Typically there will be multiple TK_SELECT_COLUMN nodes
@@ -903,8 +903,8 @@ sqlite3ExprAttachSubtrees(sqlite3 * db,
 {
 	if (pRoot == 0) {
 		assert(db->mallocFailed);
-		sql_expr_free(db, pLeft, false);
-		sql_expr_free(db, pRight, false);
+		sql_expr_delete(db, pLeft, false);
+		sql_expr_delete(db, pRight, false);
 	} else {
 		if (pRight) {
 			pRoot->pRight = pRight;
@@ -1020,8 +1020,8 @@ sqlite3ExprAnd(sqlite3 * db, Expr * pLeft, Expr * pRight)
 	} else if (pRight == 0) {
 		return pLeft;
 	} else if (exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight)) {
-		sql_expr_free(db, pLeft, false);
-		sql_expr_free(db, pRight, false);
+		sql_expr_delete(db, pLeft, false);
+		sql_expr_delete(db, pRight, false);
 		return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0],
 					0);
 	} else {
@@ -1158,7 +1158,7 @@ sqlite3ExprDeleteNN(sqlite3 * db, Expr * p, bool extern_alloc)
 		if (p->pLeft && p->op != TK_SELECT_COLUMN && !extern_alloc)
 			sqlite3ExprDeleteNN(db, p->pLeft, extern_alloc);
 		if (!extern_alloc)
-			sql_expr_free(db, p->pRight, extern_alloc);
+			sql_expr_delete(db, p->pRight, extern_alloc);
 		if (ExprHasProperty(p, EP_xIsSelect)) {
 			sqlite3SelectDelete(db, p->x.pSelect);
 		} else {
@@ -1173,7 +1173,7 @@ sqlite3ExprDeleteNN(sqlite3 * db, Expr * p, bool extern_alloc)
 }
 
 void
-sql_expr_free(sqlite3 *db, Expr *expr, bool extern_alloc)
+sql_expr_delete(sqlite3 *db, Expr *expr, bool extern_alloc)
 {
 	if (expr != NULL)
 		sqlite3ExprDeleteNN(db, expr, extern_alloc);
@@ -1661,7 +1661,7 @@ sqlite3ExprListAppend(Parse * pParse,	/* Parsing context */
 
  no_mem:
 	/* Avoid leaking memory if malloc has failed. */
-	sql_expr_free(db, pExpr, false);
+	sql_expr_delete(db, pExpr, false);
 	sqlite3ExprListDelete(db, pList);
 	return 0;
 }
@@ -1737,7 +1737,7 @@ sqlite3ExprListAppendVector(Parse * pParse,	/* Parsing context */
 	}
 
  vector_append_error:
-	sql_expr_free(db, pExpr, false);
+	sql_expr_delete(db, pExpr, false);
 	sqlite3IdListDelete(db, pColumns);
 	return pList;
 }
@@ -1838,7 +1838,7 @@ exprListDeleteNN(sqlite3 * db, ExprList * pList)
 	struct ExprList_item *pItem;
 	assert(pList->a != 0 || pList->nExpr == 0);
 	for (pItem = pList->a, i = 0; i < pList->nExpr; i++, pItem++) {
-		sql_expr_free(db, pItem->pExpr, false);
+		sql_expr_delete(db, pItem->pExpr, false);
 		sqlite3DbFree(db, pItem->zName);
 		sqlite3DbFree(db, pItem->zSpan);
 	}
@@ -2913,7 +2913,7 @@ sqlite3CodeSubselect(Parse * pParse,	/* Parsing context */
 						  dest.iSDParm);
 				VdbeComment((v, "Init EXISTS result"));
 			}
-			sql_expr_free(pParse->db, pSel->pLimit, false);
+		sql_expr_delete(pParse->db, pSel->pLimit, false);
 			pSel->pLimit = sqlite3ExprAlloc(pParse->db, TK_INTEGER,
 							&sqlite3IntTokens[1],
 							0);
@@ -4488,7 +4488,7 @@ sqlite3ExprCodeCopy(Parse * pParse, Expr * pExpr, int target)
 	pExpr = sqlite3ExprDup(db, pExpr, 0);
 	if (!db->mallocFailed)
 		sqlite3ExprCode(pParse, pExpr, target);
-	sql_expr_free(db, pExpr, false);
+	sql_expr_delete(db, pExpr, false);
 }
 
 /*
@@ -5044,7 +5044,7 @@ sqlite3ExprIfFalseDup(Parse * pParse, Expr * pExpr, int dest, int jumpIfNull)
 	if (db->mallocFailed == 0) {
 		sqlite3ExprIfFalse(pParse, pCopy, dest, jumpIfNull);
 	}
-	sql_expr_free(db, pCopy, false);
+	sql_expr_delete(db, pCopy, false);
 }
 
 /*
diff --git a/src/box/sql/fkey.c b/src/box/sql/fkey.c
index f4f7237..2ab8fdd 100644
--- a/src/box/sql/fkey.c
+++ b/src/box/sql/fkey.c
@@ -703,7 +703,7 @@ fkScanChildren(Parse * pParse,	/* Parse context */
 	}
 
 	/* Clean up the WHERE clause constructed above. */
-	sql_expr_free(db, pWhere, false);
+	sql_expr_delete(db, pWhere, false);
 	if (iFkIfZero)
 		sqlite3VdbeJumpHere(v, iFkIfZero);
 }
@@ -742,10 +742,10 @@ fkTriggerDelete(sqlite3 * dbMem, Trigger * p)
 {
 	if (p) {
 		TriggerStep *pStep = p->step_list;
-		sql_expr_free(dbMem, pStep->pWhere, false);
+		sql_expr_delete(dbMem, pStep->pWhere, false);
 		sqlite3ExprListDelete(dbMem, pStep->pExprList);
 		sqlite3SelectDelete(dbMem, pStep->pSelect);
-		sql_expr_free(dbMem, p->pWhen, false);
+		sql_expr_delete(dbMem, p->pWhen, false);
 		sqlite3DbFree(dbMem, p);
 	}
 }
@@ -1414,8 +1414,8 @@ fkActionTrigger(Parse * pParse,	/* Parse context */
 		/* Re-enable the lookaside buffer, if it was disabled earlier. */
 		db->lookaside.bDisable--;
 
-		sql_expr_free(db, pWhere, false);
-		sql_expr_free(db, pWhen, false);
+		sql_expr_delete(db, pWhere, false);
+		sql_expr_delete(db, pWhen, false);
 		sqlite3ExprListDelete(db, pList);
 		sqlite3SelectDelete(db, pSelect);
 		if (db->mallocFailed == 1) {
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 8059889..8eac310 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -635,7 +635,7 @@ joinop(X) ::= JOIN_KW(A) join_nm(B) join_nm(C) JOIN.
                   {X = sqlite3JoinType(pParse,&A,&B,&C);/*X-overwrites-A*/}
 
 %type on_opt {Expr*}
-%destructor on_opt {sql_expr_free(pParse->db, $$, false);}
+%destructor on_opt {sql_expr_delete(pParse->db, $$, false);}
 on_opt(N) ::= ON expr(E).   {N = E.pExpr;}
 on_opt(N) ::= .             {N = 0;}
 
@@ -693,7 +693,7 @@ groupby_opt(A) ::= .                      {A = 0;}
 groupby_opt(A) ::= GROUP BY nexprlist(X). {A = X;}
 
 %type having_opt {Expr*}
-%destructor having_opt {sql_expr_free(pParse->db, $$, false);}
+%destructor having_opt {sql_expr_delete(pParse->db, $$, false);}
 having_opt(A) ::= .                {A = 0;}
 having_opt(A) ::= HAVING expr(X).  {A = X.pExpr;}
 
@@ -729,7 +729,7 @@ cmd ::= with(C) DELETE FROM fullname(X) indexed_opt(I) where_opt(W). {
 }
 
 %type where_opt {Expr*}
-%destructor where_opt {sql_expr_free(pParse->db, $$, false);}
+%destructor where_opt {sql_expr_delete(pParse->db, $$, false);}
 
 where_opt(A) ::= .                    {A = 0;}
 where_opt(A) ::= WHERE expr(X).       {A = X.pExpr;}
@@ -805,9 +805,9 @@ idlist(A) ::= nm(Y).
 //
 
 %type expr {ExprSpan}
-%destructor expr {sql_expr_free(pParse->db, $$.pExpr, false);}
+%destructor expr {sql_expr_delete(pParse->db, $$.pExpr, false);}
 %type term {ExprSpan}
-%destructor term {sql_expr_free(pParse->db, $$.pExpr, false);}
+%destructor term {sql_expr_delete(pParse->db, $$.pExpr, false);}
 
 %include {
   /* This is a utility routine used to set the ExprSpan.zStart and
@@ -1015,7 +1015,7 @@ expr(A) ::= expr(A) NOT NULL(E). {spanUnaryPostfix(pParse,TK_NOTNULL,&A,&E);}
     sqlite3 *db = pParse->db;
     if( pA && pY && pY->op==TK_NULL ){
       pA->op = (u8)op;
-      sql_expr_free(db, pA->pRight, false);
+      sql_expr_delete(db, pA->pRight, false);
       pA->pRight = 0;
     }
   }
@@ -1091,7 +1091,7 @@ expr(A) ::= expr(A) in_op(N) LP exprlist(Y) RP(E). [IN] {
     ** simplify to constants 0 (false) and 1 (true), respectively,
     ** regardless of the value of expr1.
     */
-    sql_expr_free(pParse->db, A.pExpr, false);
+    sql_expr_delete(pParse->db, A.pExpr, false);
     A.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[N],1);
   }else if( Y->nExpr==1 ){
     /* Expressions of the form:
@@ -1168,7 +1168,7 @@ expr(A) ::= CASE(C) case_operand(X) case_exprlist(Y) case_else(Z) END(E). {
     sqlite3ExprSetHeightAndFlags(pParse, A.pExpr);
   }else{
     sqlite3ExprListDelete(pParse->db, Y);
-    sql_expr_free(pParse->db, Z, false);
+    sql_expr_delete(pParse->db, Z, false);
   }
 }
 %type case_exprlist {ExprList*}
@@ -1182,11 +1182,11 @@ case_exprlist(A) ::= WHEN expr(Y) THEN expr(Z). {
   A = sqlite3ExprListAppend(pParse,A, Z.pExpr);
 }
 %type case_else {Expr*}
-%destructor case_else {sql_expr_free(pParse->db, $$, false);}
+%destructor case_else {sql_expr_delete(pParse->db, $$, false);}
 case_else(A) ::=  ELSE expr(X).         {A = X.pExpr;}
 case_else(A) ::=  .                     {A = 0;} 
 %type case_operand {Expr*}
-%destructor case_operand {sql_expr_free(pParse->db, $$, false);}
+%destructor case_operand {sql_expr_delete(pParse->db, $$, false);}
 case_operand(A) ::= expr(X).            {A = X.pExpr; /*A-overwrites-X*/} 
 case_operand(A) ::= .                   {A = 0;} 
 
@@ -1353,7 +1353,7 @@ foreach_clause ::= .
 foreach_clause ::= FOR EACH ROW.
 
 %type when_clause {Expr*}
-%destructor when_clause {sql_expr_free(pParse->db, $$, false);}
+%destructor when_clause {sql_expr_delete(pParse->db, $$, false);}
 when_clause(A) ::= .             { A = 0; }
 when_clause(A) ::= WHEN expr(X). { A = X.pExpr; }
 
diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index 58aa980..7f0858a 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -115,7 +115,7 @@ resolveAlias(Parse * pParse,	/* Parsing context */
 	}
 	ExprSetProperty(pDup, EP_Alias);
 
-	/* Before calling sql_expr_free(), set the EP_Static flag. This
+	/* Before calling sql_expr_delete(), set the EP_Static flag. This
 	 * prevents ExprDelete() from deleting the Expr structure itself,
 	 * allowing it to be repopulated by the memcpy() on the following line.
 	 * The pExpr->u.zToken might point into memory that will be freed by the
@@ -123,7 +123,7 @@ resolveAlias(Parse * pParse,	/* Parsing context */
 	 * make a copy of the token before doing the sqlite3DbFree().
 	 */
 	ExprSetProperty(pExpr, EP_Static);
-	sql_expr_free(db, pExpr, false);
+	sql_expr_delete(db, pExpr, false);
 	memcpy(pExpr, pDup, sizeof(*pExpr));
 	if (!ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken != 0) {
 		assert((pExpr->flags & (EP_Reduced | EP_TokenOnly)) == 0);
@@ -464,9 +464,9 @@ lookupName(Parse * pParse,	/* The parsing context */
 
 	/* Clean up and return
 	 */
-	sql_expr_free(db, pExpr->pLeft, false);
+	sql_expr_delete(db, pExpr->pLeft, false);
 	pExpr->pLeft = 0;
-	sql_expr_free(db, pExpr->pRight, false);
+	sql_expr_delete(db, pExpr->pRight, false);
 	pExpr->pRight = 0;
 	pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
  lookupname_end:
@@ -1029,7 +1029,7 @@ resolveCompoundOrderBy(Parse * pParse,	/* Parsing context.  Leave error messages
 						    resolveOrderByTermToExprList
 						    (pParse, pSelect, pDup);
 					}
-					sql_expr_free(db, pDup, false);
+					sql_expr_delete(db, pDup, false);
 				}
 			}
 			if (iCol > 0) {
@@ -1051,7 +1051,7 @@ resolveCompoundOrderBy(Parse * pParse,	/* Parsing context.  Leave error messages
 					assert(pParent->pLeft == pE);
 					pParent->pLeft = pNew;
 				}
-				sql_expr_free(db, pE, false);
+				sql_expr_delete(db, pE, false);
 				pItem->u.x.iOrderByCol = (u16) iCol;
 				pItem->done = 1;
 			} else {
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index 5fbcbaf..75bd53d 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -97,12 +97,12 @@ clearSelect(sqlite3 * db, Select * p, int bFree)
 		Select *pPrior = p->pPrior;
 		sqlite3ExprListDelete(db, p->pEList);
 		sqlite3SrcListDelete(db, p->pSrc);
-		sql_expr_free(db, p->pWhere, false);
+		sql_expr_delete(db, p->pWhere, false);
 		sqlite3ExprListDelete(db, p->pGroupBy);
-		sql_expr_free(db, p->pHaving, false);
+		sql_expr_delete(db, p->pHaving, false);
 		sqlite3ExprListDelete(db, p->pOrderBy);
-		sql_expr_free(db, p->pLimit, false);
-		sql_expr_free(db, p->pOffset, false);
+		sql_expr_delete(db, p->pLimit, false);
+		sql_expr_delete(db, p->pOffset, false);
 		if (p->pWith)
 			sqlite3WithDelete(db, p->pWith);
 		if (bFree)
@@ -2639,7 +2639,7 @@ multiSelect(Parse * pParse,	/* Parsing context */
 							     pPrior->
 							     nSelectRow);
 				}
-				sql_expr_free(db, p->pLimit, false);
+			sql_expr_delete(db, p->pLimit, false);
 				p->pLimit = pLimit;
 				p->pOffset = pOffset;
 				p->iLimit = 0;
@@ -2738,7 +2738,7 @@ multiSelect(Parse * pParse,	/* Parsing context */
 				p->pPrior = pPrior;
 				if (p->nSelectRow > pPrior->nSelectRow)
 					p->nSelectRow = pPrior->nSelectRow;
-				sql_expr_free(db, p->pLimit, false);
+			sql_expr_delete(db, p->pLimit, false);
 				p->pLimit = pLimit;
 				p->pOffset = pOffset;
 
@@ -3277,9 +3277,9 @@ multiSelectOrderBy(Parse * pParse,	/* Parsing context */
 	} else {
 		regLimitA = regLimitB = 0;
 	}
-	sql_expr_free(db, p->pLimit, false);
+	sql_expr_delete(db, p->pLimit, false);
 	p->pLimit = 0;
-	sql_expr_free(db, p->pOffset, false);
+	sql_expr_delete(db, p->pOffset, false);
 	p->pOffset = 0;
 
 	regAddrA = ++pParse->nMem;
@@ -3494,7 +3494,7 @@ substExpr(Parse * pParse,	/* Report errors here */
 					    pExpr->iRightJoinTable;
 					pNew->flags |= EP_FromJoin;
 				}
-				sql_expr_free(db, pExpr, false);
+				sql_expr_delete(db, pExpr, false);
 				pExpr = pNew;
 			}
 		}
diff --git a/src/box/sql/trigger.c b/src/box/sql/trigger.c
index 665f65d..2704816 100644
--- a/src/box/sql/trigger.c
+++ b/src/box/sql/trigger.c
@@ -52,7 +52,7 @@ sqlite3DeleteTriggerStep(sqlite3 * db, TriggerStep * pTriggerStep)
 		TriggerStep *pTmp = pTriggerStep;
 		pTriggerStep = pTriggerStep->pNext;
 
-		sql_expr_free(db, pTmp->pWhere, false);
+		sql_expr_delete(db, pTmp->pWhere, false);
 		sqlite3ExprListDelete(db, pTmp->pExprList);
 		sqlite3SelectDelete(db, pTmp->pSelect);
 		sqlite3IdListDelete(db, pTmp->pIdList);
@@ -184,7 +184,7 @@ sqlite3BeginTrigger(Parse * pParse,	/* The parse context of the CREATE TRIGGER s
 	sqlite3DbFree(db, zName);
 	sqlite3SrcListDelete(db, pTableName);
 	sqlite3IdListDelete(db, pColumns);
-	sql_expr_free(db, pWhen, false);
+	sql_expr_delete(db, pWhen, false);
 	if (!pParse->pNewTrigger) {
 		sqlite3DeleteTrigger(db, pTrigger);
 	} else {
@@ -444,7 +444,7 @@ sqlite3TriggerUpdateStep(sqlite3 * db,	/* The database connection */
 		pTriggerStep->orconf = orconf;
 	}
 	sqlite3ExprListDelete(db, pEList);
-	sql_expr_free(db, pWhere, false);
+	sql_expr_delete(db, pWhere, false);
 	return pTriggerStep;
 }
 
@@ -467,7 +467,7 @@ sqlite3TriggerDeleteStep(sqlite3 * db,	/* Database connection */
 		    sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
 		pTriggerStep->orconf = ON_CONFLICT_ACTION_DEFAULT;
 	}
-	sql_expr_free(db, pWhere, false);
+	sql_expr_delete(db, pWhere, false);
 	return pTriggerStep;
 }
 
@@ -482,7 +482,7 @@ sqlite3DeleteTrigger(sqlite3 * db, Trigger * pTrigger)
 	sqlite3DeleteTriggerStep(db, pTrigger->step_list);
 	sqlite3DbFree(db, pTrigger->zName);
 	sqlite3DbFree(db, pTrigger->table);
-	sql_expr_free(db, pTrigger->pWhen, false);
+	sql_expr_delete(db, pTrigger->pWhen, false);
 	sqlite3IdListDelete(db, pTrigger->pColumns);
 	sqlite3DbFree(db, pTrigger);
 }
@@ -903,7 +903,7 @@ codeRowTrigger(Parse * pParse,	/* Current parse context */
 						   iEndTrigger,
 						   SQLITE_JUMPIFNULL);
 			}
-			sql_expr_free(db, pWhen, false);
+			sql_expr_delete(db, pWhen, false);
 		}
 
 		/* Code the trigger program into the sub-vdbe. */
diff --git a/src/box/sql/update.c b/src/box/sql/update.c
index 2477c83..848ae20 100644
--- a/src/box/sql/update.c
+++ b/src/box/sql/update.c
@@ -643,6 +643,6 @@ sqlite3Update(Parse * pParse,		/* The parser context */
 	sqlite3DbFree(db, aXRef);	/* Also frees aRegIdx[] and aToOpen[] */
 	sqlite3SrcListDelete(db, pTabList);
 	sqlite3ExprListDelete(db, pChanges);
-	sql_expr_free(db, pWhere, false);
+	sql_expr_delete(db, pWhere, false);
 	return;
 }
diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c
index 9685af0..8b0f21a 100644
--- a/src/box/sql/wherecode.c
+++ b/src/box/sql/wherecode.c
@@ -1818,7 +1818,7 @@ sqlite3WhereCodeOneLoopStart(WhereInfo * pWInfo,	/* Complete information about t
 			pLevel->iIdxCur = iCovCur;
 		if (pAndExpr) {
 			pAndExpr->pLeft = 0;
-			sql_expr_free(db, pAndExpr, false);
+			sql_expr_delete(db, pAndExpr, false);
 		}
 		sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v));
 		sqlite3VdbeGoto(v, pLevel->addrBrk);
diff --git a/src/box/sql/whereexpr.c b/src/box/sql/whereexpr.c
index 26c1b69..6da2762 100644
--- a/src/box/sql/whereexpr.c
+++ b/src/box/sql/whereexpr.c
@@ -97,7 +97,7 @@ whereClauseInsert(WhereClause * pWC, Expr * p, u16 wtFlags)
 					 sizeof(pWC->a[0]) * pWC->nSlot * 2);
 		if (pWC->a == 0) {
 			if (wtFlags & TERM_DYNAMIC) {
-				sql_expr_free(db, p, false);
+				sql_expr_delete(db, p, false);
 			}
 			pWC->a = pOld;
 			return 0;
@@ -1066,7 +1066,7 @@ exprAnalyze(SrcList * pSrc,	/* the FROM clause */
 				int idxNew;
 				pDup = sqlite3ExprDup(db, pExpr, 0);
 				if (db->mallocFailed) {
-					sql_expr_free(db, pDup, false);
+					sql_expr_delete(db, pDup, false);
 					return;
 				}
 				idxNew =
@@ -1405,7 +1405,7 @@ sqlite3WhereClauseClear(WhereClause * pWC)
 	sqlite3 *db = pWC->pWInfo->pParse->db;
 	for (i = pWC->nTerm - 1, a = pWC->a; i >= 0; i--, a++) {
 		if (a->wtFlags & TERM_DYNAMIC) {
-			sql_expr_free(db, a->pExpr, false);
+			sql_expr_delete(db, a->pExpr, false);
 		}
 		if (a->wtFlags & TERM_ORINFO) {
 			whereOrInfoDelete(db, a->u.pOrInfo);
-- 
2.7.4

  parent reply	other threads:[~2018-05-23 14:05 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 14:05 [tarantool-patches] [PATCH v7 0/7] sql: remove Checks to server Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 1/7] sql: remove parser construct, destruct to sql.h Kirill Shcherbatov
2018-05-23 17:46   ` [tarantool-patches] " Konstantin Osipov
2018-05-24 19:26   ` Vladislav Shpilevoy
2018-05-25 12:05     ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 2/7] box: introduce OPT_ARRAY opt_type to decode arrays Kirill Shcherbatov
2018-05-23 17:53   ` [tarantool-patches] " Konstantin Osipov
2018-05-24  7:32     ` Kirill Shcherbatov
2018-05-24 19:26   ` Vladislav Shpilevoy
2018-05-25 11:54     ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 3/7] sql: introduce expr_len for sql_expr_compile Kirill Shcherbatov
2018-05-24 19:26   ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-25 11:54     ` Kirill Shcherbatov
2018-05-23 14:05 ` Kirill Shcherbatov [this message]
2018-05-23 18:00   ` [tarantool-patches] Re: [PATCH v7 4/7] sql: rename sql_expr_free to sql_expr_delete Konstantin Osipov
2018-05-24 19:26   ` Vladislav Shpilevoy
2018-05-25 11:54     ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 5/7] sql: change sqlite3AddCheckConstraint signature Kirill Shcherbatov
2018-05-23 18:01   ` [tarantool-patches] " Konstantin Osipov
2018-05-24 19:26   ` Vladislav Shpilevoy
2018-05-25 11:53     ` Kirill Shcherbatov
2018-05-29 11:51   ` n.pettik
2018-05-30  8:32     ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 6/7] sql: export funcs defined on Expr, ExprList to sql.h Kirill Shcherbatov
2018-05-23 18:15   ` [tarantool-patches] " Konstantin Osipov
2018-05-24  7:33     ` Kirill Shcherbatov
2018-05-24 19:26   ` Vladislav Shpilevoy
2018-05-25 11:53     ` Kirill Shcherbatov
2018-05-28 11:19       ` Vladislav Shpilevoy
2018-05-28 14:59         ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 7/7] sql: remove Checks to server Kirill Shcherbatov
2018-05-24 19:26   ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-25 11:53     ` Kirill Shcherbatov
2018-05-28 11:19       ` Vladislav Shpilevoy
2018-05-28 14:59         ` Kirill Shcherbatov
2018-05-28 18:50           ` Vladislav Shpilevoy
2018-05-29 11:49   ` n.pettik
2018-05-30  8:32     ` Kirill Shcherbatov
2018-05-30 10:42       ` n.pettik
2018-05-25 12:04 ` [tarantool-patches] Re: [PATCH v7 0/7] " Kirill Shcherbatov
2018-05-28 11:19   ` Vladislav Shpilevoy
2018-05-30 11:03 ` n.pettik
2018-05-31 17:44   ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19aefd955a44af24ae84d2e07ace6921e41d991d.1527084287.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v7 4/7] sql: rename sql_expr_free to sql_expr_delete' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox