Change so that deleting an Expr structure requires only one frame per level in the expression tree, not two.

FossilOrigin-Name: a4380ab326e4b0de29271c824d041193e86b7139
This commit is contained in:
dan 2009-11-23 14:39:14 +00:00
parent fc7e7c7c84
commit f6963f99dd
5 changed files with 20 additions and 34 deletions

View File

@ -1,8 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Bump\sthe\sversion\snumber\sto\s3.6.21.
D 2009-11-23T13:17:27
C Change\sso\sthat\sdeleting\san\sExpr\sstructure\srequires\sonly\sone\sframe\sper\slevel\sin\sthe\sexpression\stree,\snot\stwo.
D 2009-11-23T14:39:15
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 7f6c6aa7feeeb5e26e01b344161d9aa1b5d64177
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -119,7 +116,7 @@ F src/callback.c 908f3e0172c3d4058f4ca0acd42c637c52e9669f
F src/complete.c 417df1ef5ea798532bb6290b0cc4265fef82980a
F src/date.c a79c0a8f219370b972e320741f995a3bef9df33f
F src/delete.c ec04635d152debdab70d4b30c5516b59282075ea
F src/expr.c bd248461bfb8290e3bb1da668660d42ab1a75464
F src/expr.c 50385ed51f1cd7f1ab289629cd0f87d5b2fcca52
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e2116672a6bd610dc888e27df292ebc7999c9bb0
F src/func.c bf54e1202cbfb28bf4b1fd9b58899009ae76716f
@ -163,13 +160,13 @@ F src/pragma.c 6936d7df5e04b9f996f8f320d15e65b6944b2caa
F src/prepare.c ad90970bba3aead154266d8bb6faf9fbb5233b94
F src/printf.c 03fabdd6112a0e23f78f8ac9a1396947ade0273b
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c aa3cb21e1ecd905c071fce8fb64d1a166cefc239
F src/resolve.c c52d9e52e11058f4113f6644adc20d3f85141b1d
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c 2f9ed7482e7a25b0b127fc41693bbdbe1caf5647
F src/shell.c f4948cb6d30665d755a6b5e0ec313d1094aab828
F src/sqlite.h.in 4464e9772122f0447305d425e04d122b6f1bffec
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
F src/sqliteInt.h e4d1e5233b2430b7e69ae551e16975304f5a60d6
F src/sqliteInt.h 8ee7b66de2169dc958744e036b3b1550710a7b6e
F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6
F src/status.c e651be6b30d397d86384c6867bc016e4913bcac7
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
@ -775,14 +772,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P b6402b2065b844acb3f1bb94ad964568706bcb86
R 4b616a70a19ad11911ec1cd1ff6b4d34
U drh
Z a06eed9e2c1f3955759bf18dccaf71fe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLCottoxKgR168RlERAjDnAJ0cixM0IoiHqp94GwbhmmRuxTkxhwCeLN4C
MrhYNgDkN4UdVQNYUggEijM=
=D4Yq
-----END PGP SIGNATURE-----
P 39214aee6553db76309851e7aa74fcc02d4f59b7
R 673f464af9f0a676a75a7dfadac3e11c
U dan
Z 0e8b7d6b7e381316eea3c397c4c24db2

View File

@ -1 +1 @@
39214aee6553db76309851e7aa74fcc02d4f59b7
a4380ab326e4b0de29271c824d041193e86b7139

View File

@ -627,11 +627,10 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
}
/*
** Clear an expression structure without deleting the structure itself.
** Substructure is deleted.
** Recursively delete an expression tree.
*/
void sqlite3ExprClear(sqlite3 *db, Expr *p){
assert( p!=0 );
void sqlite3ExprDelete(sqlite3 *db, Expr *p){
if( p==0 ) return;
if( !ExprHasAnyProperty(p, EP_TokenOnly) ){
sqlite3ExprDelete(db, p->pLeft);
sqlite3ExprDelete(db, p->pRight);
@ -644,14 +643,6 @@ void sqlite3ExprClear(sqlite3 *db, Expr *p){
sqlite3ExprListDelete(db, p->x.pList);
}
}
}
/*
** Recursively delete an expression tree.
*/
void sqlite3ExprDelete(sqlite3 *db, Expr *p){
if( p==0 ) return;
sqlite3ExprClear(db, p);
if( !ExprHasProperty(p, EP_Static) ){
sqlite3DbFree(db, p);
}

View File

@ -87,7 +87,13 @@ static void resolveAlias(
pDup->pColl = pExpr->pColl;
pDup->flags |= EP_ExpCollate;
}
sqlite3ExprClear(db, pExpr);
/* Before calling sqlite3ExprDelete(), 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.
*/
ExprSetProperty(pExpr, EP_Static);
sqlite3ExprDelete(db, pExpr);
memcpy(pExpr, pDup, sizeof(*pExpr));
sqlite3DbFree(db, pDup);
}

View File

@ -2544,7 +2544,6 @@ Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*);
Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
void sqlite3ExprAssignVarNumber(Parse*, Expr*);
void sqlite3ExprClear(sqlite3*, Expr*);
void sqlite3ExprDelete(sqlite3*, Expr*);
ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);