1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Unwind some complex conditions in sqlite3BtreeDelete() into

separate "if" statements. (CVS 6879)

FossilOrigin-Name: d99bde9ca61eeccfe6363ff0882fd4bcdb9a34dc
This commit is contained in:
drh
2009-07-11 13:13:11 +00:00
parent d8a3f3dd0d
commit a4ec1d443a
3 changed files with 25 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
C Remove\sanother\sunreachable\sbranch\sfrom\sbtree.c.\s(CVS\s6878) C Unwind\ssome\scomplex\sconditions\sin\ssqlite3BtreeDelete()\sinto\nseparate\s"if"\sstatements.\s(CVS\s6879)
D 2009-07-11T11:45:23 D 2009-07-11T13:13:12
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3 F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119 F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
F src/btree.c 0fd74216129d46963569974e5f130f4d430bc0f3 F src/btree.c a080b574ea4b07df9deca83e0e38e8f08015a0ac
F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
F src/btreeInt.h a568bf057aa249eb06fd31358b4393a5ac88c118 F src/btreeInt.h a568bf057aa249eb06fd31358b4393a5ac88c118
F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4 F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 709576c670f802bf4b6e5c0e8db2bbde2cc16a90 P b0853100a9f8e185e8d027502822337a79a2ba0c
R b051b6b029b2fee8203200a628dc9718 R 05d593da2e562ad999268c4d47bcf9b6
U danielk1977 U drh
Z 7c7dcb726643c689fb2026dd4d5cc411 Z f7f774b2e1b61b0e01a61f9c5bfb1c62

View File

@@ -1 +1 @@
b0853100a9f8e185e8d027502822337a79a2ba0c d99bde9ca61eeccfe6363ff0882fd4bcdb9a34dc

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** May you share freely, never taking more than you give.
** **
************************************************************************* *************************************************************************
** $Id: btree.c,v 1.677 2009/07/11 11:45:23 danielk1977 Exp $ ** $Id: btree.c,v 1.678 2009/07/11 13:13:12 drh Exp $
** **
** This file implements a external (disk-based) database using BTrees. ** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information. ** See the header comment on "btreeInt.h" for additional information.
@@ -6551,14 +6551,16 @@ int sqlite3BtreeDelete(BtCursor *pCur){
/* Save the positions of any other cursors open on this table before /* Save the positions of any other cursors open on this table before
** making any modifications. Make the page containing the entry to be ** making any modifications. Make the page containing the entry to be
** deleted writable. Then free any overflow pages associated with the ** deleted writable. Then free any overflow pages associated with the
** entry and finally remove the cell itself from within the page. */ ** entry and finally remove the cell itself from within the page.
if( SQLITE_OK!=(rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur)) */
|| SQLITE_OK!=(rc = sqlite3PagerWrite(pPage->pDbPage)) rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur);
|| SQLITE_OK!=(rc = clearCell(pPage, pCell)) if( rc ) return rc;
|| SQLITE_OK!=(rc = dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell))) rc = sqlite3PagerWrite(pPage->pDbPage);
){ if( rc ) return rc;
return rc; rc = clearCell(pPage, pCell);
} if( rc ) return rc;
rc = dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell));
if( rc ) return rc;
/* If the cell deleted was not located on a leaf page, then the cursor /* If the cell deleted was not located on a leaf page, then the cursor
** is currently pointing to the largest entry in the sub-tree headed ** is currently pointing to the largest entry in the sub-tree headed
@@ -6578,12 +6580,12 @@ int sqlite3BtreeDelete(BtCursor *pCur){
allocateTempSpace(pBt); allocateTempSpace(pBt);
pTmp = pBt->pTmpSpace; pTmp = pBt->pTmpSpace;
if( SQLITE_OK!=(rc = sqlite3PagerWrite(pLeaf->pDbPage)) rc = sqlite3PagerWrite(pLeaf->pDbPage);
|| SQLITE_OK!=(rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n)) if( rc ) return rc;
|| SQLITE_OK!=(rc = dropCell(pLeaf, pLeaf->nCell-1, nCell)) rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n);
){ if( rc ) return rc;
return rc; rc = dropCell(pLeaf, pLeaf->nCell-1, nCell);
} if( rc ) return rc;
} }
/* Balance the tree. If the entry deleted was located on a leaf page, /* Balance the tree. If the entry deleted was located on a leaf page,