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

Reverse the order of two conditionals in a test in order to achieve coverage

of them both.  Also: clarifications to comments in btree.c. (CVS 6912)

FossilOrigin-Name: a159e9d24708dfe6c5a98d220e39f3b1b2a3d281
This commit is contained in:
drh
2009-07-20 19:30:00 +00:00
parent 98add2ed74
commit cd09c53d7f
3 changed files with 17 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
C Modify\svarious\sroutines\sinside\sbtree.c\sto\stake\sa\spointer\sto\sthe\sreturn-code\nas\sa\sparameter\sand\sto\sno-op\sif\sthe\sreturn-code\sstorage\slocation\salready\ncontains\sa\snon-zero\scode.\s(CVS\s6911)
D 2009-07-20T17:11:50
C Reverse\sthe\sorder\sof\stwo\sconditionals\sin\sa\stest\sin\sorder\sto\sachieve\scoverage\nof\sthem\sboth.\s\sAlso:\sclarifications\sto\scomments\sin\sbtree.c.\s(CVS\s6912)
D 2009-07-20T19:30:01
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c cfbf6af5b0ababb4f06ed3e75c616dadaf47fcbd
F src/btmutex.c 0f43a75bb5b8147b386e8e1c3e71ba734e3863b7
F src/btree.c a597d1d9608c88d6ce06f89c396fb560d244f2bc
F src/btree.c 123dd6ab71226ee9c41d6658fd11b2f7bed73f44
F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705
F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -741,7 +741,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 609022caff12c010575e704be550da6f52226d33
R f0dac37b25de3361940901b7ede7713d
P 7dcf2a78727ce448d9d26bd6e2e23b553456ec54
R ee81aff6c227cadf19a47a764a1a15d2
U drh
Z 0886d43bf9f8d479825e913af0119cfa
Z f9f7c95bd23663f1ba6a8b648cb1cde3

View File

@@ -1 +1 @@
7dcf2a78727ce448d9d26bd6e2e23b553456ec54
a159e9d24708dfe6c5a98d220e39f3b1b2a3d281

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.692 2009/07/20 17:11:50 drh Exp $
** $Id: btree.c,v 1.693 2009/07/20 19:30:01 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -5590,9 +5590,9 @@ static int copyNodeContent(MemPage *pFrom, MemPage *pTo){
** be rolled back.
**
** The third argument to this function, aOvflSpace, is a pointer to a
** buffer page-size bytes in size. If, in inserting cells into the parent
** page (pParent), the parent page becomes overfull, this buffer is
** used to store the parents overflow cells. Because this function inserts
** buffer big enough to hold one page. If while inserting cells into the parent
** page (pParent) the parent page becomes overfull, this buffer is
** used to store the parent's overflow cells. Because this function inserts
** a maximum of four divider cells into the parent page, and the maximum
** size of a cell stored within an internal node is always less than 1/4
** of the page-size, the aOvflSpace[] buffer is guaranteed to be large
@@ -5646,7 +5646,8 @@ static int balance_nonroot(
/* At this point pParent may have at most one overflow cell. And if
** this overflow cell is present, it must be the cell with
** index iParentIdx. This scenario comes about when this function
** is called (indirectly) from sqlite3BtreeDelete(). */
** is called (indirectly) from sqlite3BtreeDelete().
*/
assert( pParent->nOverflow==0 || pParent->nOverflow==1 );
assert( pParent->nOverflow==0 || pParent->aOvfl[0].idx==iParentIdx );
@@ -5662,8 +5663,9 @@ static int balance_nonroot(
**
** This loop also drops the divider cells from the parent page. This
** way, the remainder of the function does not have to deal with any
** overflow cells in the parent page, as if one existed it has already
** been removed. */
** overflow cells in the parent page, since if any existed they will
** have already been removed.
*/
i = pParent->nOverflow + pParent->nCell;
if( i<2 ){
nxDiv = 0;
@@ -5694,7 +5696,7 @@ static int balance_nonroot(
nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
if( (i--)==0 ) break;
if( pParent->nOverflow && i+nxDiv==pParent->aOvfl[0].idx ){
if( i+nxDiv==pParent->aOvfl[0].idx && pParent->nOverflow ){
apDiv[i] = pParent->aOvfl[0].pCell;
pgno = get4byte(apDiv[i]);
szNew[i] = cellSizePtr(pParent, apDiv[i]);