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:
23
src/rowset.c
23
src/rowset.c
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user