]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove some needless recursion from compound SELECT processing.
authordrh <drh@noemail.net>
Mon, 5 Jan 2015 15:48:45 +0000 (15:48 +0000)
committerdrh <drh@noemail.net>
Mon, 5 Jan 2015 15:48:45 +0000 (15:48 +0000)
FossilOrigin-Name: fe677d13f03e24fa667efc0c2e7f5bbb99521791

manifest
manifest.uuid
src/select.c

index 7158c3bb7af3d26c8b64a11f415b41fe7021aeaa..58de1597485ed420a2907c0e488e7dee1653ff1d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sreleasetest.tcl,\somit\sthe\sCC=clang\stext\sfrom\sthe\slabel\son\sSanitize\stests,\nso\sthat\sthe\slabel\sfits\son\san\s80-character\sline.
-D 2015-01-03T18:59:17.732
+C Remove\ssome\sneedless\srecursion\sfrom\scompound\sSELECT\sprocessing.
+D 2015-01-05T15:48:45.607
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -228,7 +228,7 @@ F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236
 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada
 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
-F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75
+F src/select.c 28cf616a8791ff154be86bd9a3f888440f618e78
 F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf
 F src/sqlite.h.in ed799ff5c814227c7957eb4f4a217f67fdc0da48
 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
@@ -1234,7 +1234,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P e0de580726a0ed35565783ed14440ef9bcdc3a3d
-R f6cee47d01cb42bf3184c460b0355569
+P 23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6
+R 11413a03283b5c5b28fd422ab566eba3
 U drh
-Z f9858d5c3468a9943c6533c5ebc7e99c
+Z 4fbaf4abfb36941c7ce4c15be9a07b21
index 49b92f4c8b57e70ef81aca62ec7ccb7ad2bccd1b..7801476f7ecf136489dcd384769ed4134b9beb3a 100644 (file)
@@ -1 +1 @@
-23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6
\ No newline at end of file
+fe677d13f03e24fa667efc0c2e7f5bbb99521791
\ No newline at end of file
index 070ac004107c923afa5311f0351ebe931df68cbc..bc4f8a37c32557bef3a5556db512a6d45c704861 100644 (file)
@@ -58,20 +58,25 @@ struct SortCtx {
 #define SORTFLAG_UseSorter  0x01   /* Use SorterOpen instead of OpenEphemeral */
 
 /*
-** Delete all the content of a Select structure but do not deallocate
-** the select structure itself.
+** Delete all the content of a Select structure.  Deallocate the structure
+** itself only if bFree is true.
 */
-static void clearSelect(sqlite3 *db, Select *p){
-  sqlite3ExprListDelete(db, p->pEList);
-  sqlite3SrcListDelete(db, p->pSrc);
-  sqlite3ExprDelete(db, p->pWhere);
-  sqlite3ExprListDelete(db, p->pGroupBy);
-  sqlite3ExprDelete(db, p->pHaving);
-  sqlite3ExprListDelete(db, p->pOrderBy);
-  sqlite3SelectDelete(db, p->pPrior);
-  sqlite3ExprDelete(db, p->pLimit);
-  sqlite3ExprDelete(db, p->pOffset);
-  sqlite3WithDelete(db, p->pWith);
+static void clearSelect(sqlite3 *db, Select *p, int bFree){
+  while( p ){
+    Select *pPrior = p->pPrior;
+    sqlite3ExprListDelete(db, p->pEList);
+    sqlite3SrcListDelete(db, p->pSrc);
+    sqlite3ExprDelete(db, p->pWhere);
+    sqlite3ExprListDelete(db, p->pGroupBy);
+    sqlite3ExprDelete(db, p->pHaving);
+    sqlite3ExprListDelete(db, p->pOrderBy);
+    sqlite3ExprDelete(db, p->pLimit);
+    sqlite3ExprDelete(db, p->pOffset);
+    sqlite3WithDelete(db, p->pWith);
+    if( bFree ) sqlite3DbFree(db, p);
+    p = pPrior;
+    bFree = 1;
+  }
 }
 
 /*
@@ -130,8 +135,7 @@ Select *sqlite3SelectNew(
   pNew->addrOpenEphm[0] = -1;
   pNew->addrOpenEphm[1] = -1;
   if( db->mallocFailed ) {
-    clearSelect(db, pNew);
-    if( pNew!=&standin ) sqlite3DbFree(db, pNew);
+    clearSelect(db, pNew, pNew!=&standin);
     pNew = 0;
   }else{
     assert( pNew->pSrc!=0 || pParse->nErr>0 );
@@ -156,10 +160,7 @@ void sqlite3SelectSetName(Select *p, const char *zName){
 ** Delete the given Select structure and all of its substructures.
 */
 void sqlite3SelectDelete(sqlite3 *db, Select *p){
-  if( p ){
-    clearSelect(db, p);
-    sqlite3DbFree(db, p);
-  }
+  clearSelect(db, p, 1);
 }
 
 /*