/ Check-in [90f40cd3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove unreachable condition from rtree.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 90f40cd36860d3af13ec24575dff7cc1f57ac493
User & Date: dan 2010-08-26 11:27:23
Context
2010-08-26
14:15
Fix a couple of memory leaks in r-tree that can occur following an OOM condition. check-in: 1975a27c user: dan tags: trunk
11:27
Remove unreachable condition from rtree.c. check-in: 90f40cd3 user: dan tags: trunk
07:59
Improve coverage of rtree.c some more. check-in: bee1959d user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

  2158   2158   }
  2159   2159   
  2160   2160   /*
  2161   2161   ** Delete the cell at index iCell of node pNode. After removing the
  2162   2162   ** cell, adjust the r-tree data structure if required.
  2163   2163   */
  2164   2164   static int deleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell, int iHeight){
         2165  +  RtreeNode *pParent;
  2165   2166     int rc;
  2166   2167   
  2167   2168     if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){
  2168   2169       return rc;
  2169   2170     }
  2170   2171   
  2171   2172     /* Remove the cell from the node. This call just moves bytes around
................................................................................
  2174   2175     nodeDeleteCell(pRtree, pNode, iCell);
  2175   2176   
  2176   2177     /* If the node is not the tree root and now has less than the minimum
  2177   2178     ** number of cells, remove it from the tree. Otherwise, update the
  2178   2179     ** cell in the parent node so that it tightly contains the updated
  2179   2180     ** node.
  2180   2181     */
  2181         -  if( pNode->iNode!=1 ){
  2182         -    RtreeNode *pParent = pNode->pParent;
  2183         -    if( (pParent->iNode!=1 || NCELL(pParent)!=1) 
  2184         -     && (NCELL(pNode)<RTREE_MINCELLS(pRtree))
  2185         -    ){
         2182  +  pParent = pNode->pParent;
         2183  +  assert( pParent || pNode->iNode==1 );
         2184  +  if( pParent ){
         2185  +    if( NCELL(pNode)<RTREE_MINCELLS(pRtree) ){
  2186   2186         rc = removeNode(pRtree, pNode, iHeight);
  2187   2187       }else{
  2188   2188         fixBoundingBox(pRtree, pNode);
  2189   2189       }
  2190   2190     }
  2191   2191   
  2192   2192     return rc;