1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Rearrange some code in the RowSet logic for clarity of presentation, while

adding an /*OPTIMIZATION-IF-TRUE*/ comment.  It should operate identically.

FossilOrigin-Name: 5748e64376c1c2be5154a632d1527cfebbb9ec74
This commit is contained in:
drh
2016-04-28 18:53:08 +00:00
parent 75ab50ce8f
commit cb6d66becc
3 changed files with 20 additions and 17 deletions

View File

@@ -338,20 +338,23 @@ static struct RowSetEntry *rowSetNDeepTree(
if( *ppList==0 ){
return 0;
}
if( iDepth==1 ){
if( iDepth>1 ){ /*OPTIMIZATION-IF-TRUE*/
/* This branch cases a *balanced* tree to be generated. A valid tree
** is still generated without this branch, but it is wildly unbalanced
** and inefficient. */
pLeft = rowSetNDeepTree(ppList, iDepth-1);
p = *ppList;
if( p==0 ){
return pLeft;
}
p->pLeft = pLeft;
*ppList = p->pRight;
p->pRight = rowSetNDeepTree(ppList, iDepth-1);
}else{
p = *ppList;
*ppList = p->pRight;
p->pLeft = p->pRight = 0;
return p;
}
pLeft = rowSetNDeepTree(ppList, iDepth-1);
p = *ppList;
if( p==0 ){
return pLeft;
}
p->pLeft = pLeft;
*ppList = p->pRight;
p->pRight = rowSetNDeepTree(ppList, iDepth-1);
return p;
}