mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Remove unreachable code from function btreeCursor() in btree.c. (CVS 6848)
FossilOrigin-Name: c76a366ed4dc63604ff695b3ee9c183e430a367e
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Remove\sa\sredundant\sbranch\sfrom\sbtree.c.\s(CVS\s6847)
|
C Remove\sunreachable\scode\sfrom\sfunction\sbtreeCursor()\sin\sbtree.c.\s(CVS\s6848)
|
||||||
D 2009-07-04T15:41:03
|
D 2009-07-04T17:16:01
|
||||||
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 97a3859d8585eb4fcb1e81a795cf4b3fdd82f30f
|
F src/backup.c 97a3859d8585eb4fcb1e81a795cf4b3fdd82f30f
|
||||||
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
|
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
|
||||||
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
|
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
|
||||||
F src/btree.c 464fbd75cfa198659088e424d5907aa025768628
|
F src/btree.c 1c12a097a14ea756696a8a0857e587a1fc5533de
|
||||||
F src/btree.h 8cae6364735a5cb2d577ddb23fa6d0e655a4b931
|
F src/btree.h 8cae6364735a5cb2d577ddb23fa6d0e655a4b931
|
||||||
F src/btreeInt.h b31e5ac04181c7e2892c33ab06228c551df6233c
|
F src/btreeInt.h b31e5ac04181c7e2892c33ab06228c551df6233c
|
||||||
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 983cb6924b8a7d3057718b9228c0cb2fbe7f0dc4
|
P 133357d2f070ba303deddff59beead1ec8d10521
|
||||||
R 40c2a0bb68ce632cd8e5f2261811a36c
|
R 59d54d3f3ef42572419a3b06be70cd73
|
||||||
U danielk1977
|
U danielk1977
|
||||||
Z b09eed1324988822c632e7993ab98935
|
Z 270b59a313a8b2cb36f6d34f9f7ea02b
|
||||||
|
@@ -1 +1 @@
|
|||||||
133357d2f070ba303deddff59beead1ec8d10521
|
c76a366ed4dc63604ff695b3ee9c183e430a367e
|
48
src/btree.c
48
src/btree.c
@@ -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.651 2009/07/04 15:41:03 danielk1977 Exp $
|
** $Id: btree.c,v 1.652 2009/07/04 17:16:01 danielk1977 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.
|
||||||
@@ -3166,8 +3166,10 @@ int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
** Create a new cursor for the BTree whose root is on the page
|
** Create a new cursor for the BTree whose root is on the page
|
||||||
** iTable. The act of acquiring a cursor gets a read lock on
|
** iTable. If a read-only cursor is requested, it is assumed that
|
||||||
** the database file.
|
** the caller already has at least a read-only transaction open
|
||||||
|
** on the database already. If a write-cursor is requested, then
|
||||||
|
** the caller is assumed to have an open write transaction.
|
||||||
**
|
**
|
||||||
** If wrFlag==0, then the cursor can only be used for reading.
|
** If wrFlag==0, then the cursor can only be used for reading.
|
||||||
** If wrFlag==1, then the cursor can be used for reading or for
|
** If wrFlag==1, then the cursor can be used for reading or for
|
||||||
@@ -3201,9 +3203,8 @@ static int btreeCursor(
|
|||||||
struct KeyInfo *pKeyInfo, /* First arg to comparison function */
|
struct KeyInfo *pKeyInfo, /* First arg to comparison function */
|
||||||
BtCursor *pCur /* Space for new cursor */
|
BtCursor *pCur /* Space for new cursor */
|
||||||
){
|
){
|
||||||
int rc;
|
int rc; /* Return code */
|
||||||
Pgno nPage;
|
BtShared *pBt = p->pBt; /* Shared b-tree handle */
|
||||||
BtShared *pBt = p->pBt;
|
|
||||||
|
|
||||||
assert( sqlite3BtreeHoldsMutex(p) );
|
assert( sqlite3BtreeHoldsMutex(p) );
|
||||||
assert( wrFlag==0 || wrFlag==1 );
|
assert( wrFlag==0 || wrFlag==1 );
|
||||||
@@ -3215,34 +3216,27 @@ static int btreeCursor(
|
|||||||
assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, wrFlag+1) );
|
assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, wrFlag+1) );
|
||||||
assert( wrFlag==0 || !hasReadConflicts(p, iTable) );
|
assert( wrFlag==0 || !hasReadConflicts(p, iTable) );
|
||||||
|
|
||||||
|
/* Assert that the caller has opened the required transaction. */
|
||||||
|
assert( p->inTrans>TRANS_NONE );
|
||||||
|
assert( wrFlag==0 || p->inTrans==TRANS_WRITE );
|
||||||
|
assert( pBt->pPage1 && pBt->pPage1->aData );
|
||||||
|
|
||||||
if( NEVER(wrFlag && pBt->readOnly) ){
|
if( NEVER(wrFlag && pBt->readOnly) ){
|
||||||
return SQLITE_READONLY;
|
return SQLITE_READONLY;
|
||||||
}
|
}
|
||||||
|
if( iTable==1 && pagerPagecount(pBt)==0 ){
|
||||||
|
return SQLITE_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
if( pBt->pPage1==0 ){
|
|
||||||
rc = lockBtreeWithRetry(p);
|
|
||||||
if( rc!=SQLITE_OK ){
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pCur->pgnoRoot = (Pgno)iTable;
|
pCur->pgnoRoot = (Pgno)iTable;
|
||||||
rc = sqlite3PagerPagecount(pBt->pPager, (int *)&nPage);
|
|
||||||
if( rc!=SQLITE_OK ){
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
if( iTable==1 && nPage==0 ){
|
|
||||||
rc = SQLITE_EMPTY;
|
|
||||||
goto create_cursor_exception;
|
|
||||||
}
|
|
||||||
rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->apPage[0]);
|
rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->apPage[0]);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
goto create_cursor_exception;
|
assert( pCur->apPage[0]==0 );
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now that no other errors can occur, finish filling in the BtCursor
|
/* Now that no other errors can occur, finish filling in the BtCursor
|
||||||
** variables, link the cursor into the BtShared list and set *ppCur (the
|
** variables and link the cursor into the BtShared list. */
|
||||||
** output argument to this function).
|
|
||||||
*/
|
|
||||||
pCur->pKeyInfo = pKeyInfo;
|
pCur->pKeyInfo = pKeyInfo;
|
||||||
pCur->pBtree = p;
|
pCur->pBtree = p;
|
||||||
pCur->pBt = pBt;
|
pCur->pBt = pBt;
|
||||||
@@ -3254,13 +3248,7 @@ static int btreeCursor(
|
|||||||
pBt->pCursor = pCur;
|
pBt->pCursor = pCur;
|
||||||
pCur->eState = CURSOR_INVALID;
|
pCur->eState = CURSOR_INVALID;
|
||||||
pCur->cachedRowid = 0;
|
pCur->cachedRowid = 0;
|
||||||
|
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
|
|
||||||
create_cursor_exception:
|
|
||||||
releasePage(pCur->apPage[0]);
|
|
||||||
unlockBtreeIfUnused(pBt);
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
int sqlite3BtreeCursor(
|
int sqlite3BtreeCursor(
|
||||||
Btree *p, /* The btree */
|
Btree *p, /* The btree */
|
||||||
|
Reference in New Issue
Block a user