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

Shorten all lines of source code in btree.c to at most 80 characters.

No logical changes.

FossilOrigin-Name: 5dd41cdbfebdd088ebd9a90a394ee296c207ad90
This commit is contained in:
drh
2014-09-24 01:23:00 +00:00
parent 3e28ff5cb5
commit 3f3874030c
3 changed files with 37 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
C Add\sthe\sMemPage.noPayload\sboolean\sand\suse\sit\sto\shelp\ncellSizePtr()\sand\sbtreeParseCellPtr()\srun\sfaster. C Shorten\sall\slines\sof\ssource\scode\sin\sbtree.c\sto\sat\smost\s80\scharacters.\nNo\slogical\schanges.
D 2014-09-24T00:59:08.082 D 2014-09-24T01:23:00.817
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -172,7 +172,7 @@ F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2
F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
F src/btree.c d64b3c5569bda0e7fbe9bc9388e17eaf70d63dec F src/btree.c 3732a278d80867b06f8ed3dfa95338d021f874b0
F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8 F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
F src/btreeInt.h 9db0d303b203d18871dc9a1d78a3e1ae4d62c1ef F src/btreeInt.h 9db0d303b203d18871dc9a1d78a3e1ae4d62c1ef
F src/build.c 8dbca25988045fbf2a33c9631c42706fa6449e60 F src/build.c 8dbca25988045fbf2a33c9631c42706fa6449e60
@@ -1200,7 +1200,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P f480582ccae0e9a917d4523191025bd16016ba64 P 8e3375313ebbf26b68561f3ed31d2a488222e5d0
R a8f50a441085b36b058ddd2aec76446f R 7f460f85115b9f5ff284729f30ee857e
U drh U drh
Z b0d06d7ed20970cccde4605a2a98dc92 Z 15056c33153d13d2de1255f45fb692fc

View File

@@ -1 +1 @@
8e3375313ebbf26b68561f3ed31d2a488222e5d0 5dd41cdbfebdd088ebd9a90a394ee296c207ad90

View File

@@ -487,7 +487,9 @@ static void invalidateIncrblobCursors(
BtShared *pBt = pBtree->pBt; BtShared *pBt = pBtree->pBt;
assert( sqlite3BtreeHoldsMutex(pBtree) ); assert( sqlite3BtreeHoldsMutex(pBtree) );
for(p=pBt->pCursor; p; p=p->pNext){ for(p=pBt->pCursor; p; p=p->pNext){
if( (p->curFlags & BTCF_Incrblob)!=0 && (isClearTable || p->info.nKey==iRow) ){ if( (p->curFlags & BTCF_Incrblob)!=0
&& (isClearTable || p->info.nKey==iRow)
){
p->eState = CURSOR_INVALID; p->eState = CURSOR_INVALID;
} }
} }
@@ -660,9 +662,9 @@ static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
** broken out from its caller to avoid unnecessary stack pointer movement. ** broken out from its caller to avoid unnecessary stack pointer movement.
*/ */
static int SQLITE_NOINLINE saveCursorsOnList( static int SQLITE_NOINLINE saveCursorsOnList(
BtCursor *p, /* The first cursor that needs saving */ BtCursor *p, /* The first cursor that needs saving */
Pgno iRoot, /* Only save cursor with this iRoot. Save all if zero */ Pgno iRoot, /* Only save cursor with this iRoot. Save all if zero */
BtCursor *pExcept /* Do not save this cursor */ BtCursor *pExcept /* Do not save this cursor */
){ ){
do{ do{
if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){ if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
@@ -1051,9 +1053,9 @@ static void btreeParseCell(
** the space used by the cell pointer. ** the space used by the cell pointer.
*/ */
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */ u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
u8 *pEnd; /* End mark for a varint */ u8 *pEnd; /* End mark for a varint */
u32 nSize; /* Size value to return */ u32 nSize; /* Size value to return */
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
/* The value returned by this function should always be the same as /* The value returned by this function should always be the same as
@@ -1336,7 +1338,7 @@ defragment_page:
** routine and return SQLITE_CORRUPT if any problems are found. ** routine and return SQLITE_CORRUPT if any problems are found.
*/ */
static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
u16 iPtr; /* Address of pointer to next freeblock */ u16 iPtr; /* Address of ptr to next freeblock */
u16 iFreeBlk; /* Address of the next freeblock */ u16 iFreeBlk; /* Address of the next freeblock */
u8 hdr; /* Page header size. 0 or 100 */ u8 hdr; /* Page header size. 0 or 100 */
u8 nFrag = 0; /* Reduction in fragmentation */ u8 nFrag = 0; /* Reduction in fragmentation */
@@ -1388,9 +1390,9 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
iFreeBlk = get2byte(&data[iFreeBlk]); iFreeBlk = get2byte(&data[iFreeBlk]);
} }
/* If iPtr is another freeblock (that is, if iPtr is not the freelist pointer /* If iPtr is another freeblock (that is, if iPtr is not the freelist
** in the page header) then check to see if iStart should be coalesced ** pointer in the page header) then check to see if iStart should be
** onto the end of iPtr. ** coalesced onto the end of iPtr.
*/ */
if( iPtr>hdr+1 ){ if( iPtr>hdr+1 ){
int iPtrEnd = iPtr + get2byte(&data[iPtr+2]); int iPtrEnd = iPtr + get2byte(&data[iPtr+2]);
@@ -4016,14 +4018,14 @@ static int accessPayload(
MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */ MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */
BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */ BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */
#ifdef SQLITE_DIRECT_OVERFLOW_READ #ifdef SQLITE_DIRECT_OVERFLOW_READ
int bEnd; /* True if reading to end of data */ int bEnd; /* True if reading to end of data */
#endif #endif
assert( pPage ); assert( pPage );
assert( pCur->eState==CURSOR_VALID ); assert( pCur->eState==CURSOR_VALID );
assert( pCur->aiIdx[pCur->iPage]<pPage->nCell ); assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );
assert( cursorHoldsMutex(pCur) ); assert( cursorHoldsMutex(pCur) );
assert( eOp!=2 || offset==0 ); /* Always start from beginning for eOp==2 */ assert( eOp!=2 || offset==0 ); /* Always start from beginning for eOp==2 */
getCellInfo(pCur); getCellInfo(pCur);
aPayload = pCur->info.pPayload; aPayload = pCur->info.pPayload;
@@ -4088,7 +4090,9 @@ static int accessPayload(
** entry for the first required overflow page is valid, skip ** entry for the first required overflow page is valid, skip
** directly to it. ** directly to it.
*/ */
if( (pCur->curFlags & BTCF_ValidOvfl)!=0 && pCur->aOverflow[offset/ovflSize] ){ if( (pCur->curFlags & BTCF_ValidOvfl)!=0
&& pCur->aOverflow[offset/ovflSize]
){
iIdx = (offset/ovflSize); iIdx = (offset/ovflSize);
nextPage = pCur->aOverflow[iIdx]; nextPage = pCur->aOverflow[iIdx];
offset = (offset%ovflSize); offset = (offset%ovflSize);
@@ -4953,9 +4957,9 @@ int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
** **
** The main entry point is sqlite3BtreePrevious(). That routine is optimized ** The main entry point is sqlite3BtreePrevious(). That routine is optimized
** for the common case of merely decrementing the cell counter BtCursor.aiIdx ** for the common case of merely decrementing the cell counter BtCursor.aiIdx
** to the previous cell on the current page. The (slower) btreePrevious() helper ** to the previous cell on the current page. The (slower) btreePrevious()
** routine is called when it is necessary to move to a different page or ** helper routine is called when it is necessary to move to a different page
** to restore the cursor. ** or to restore the cursor.
** **
** The calling function will set *pRes to 0 or 1. The initial *pRes value ** The calling function will set *pRes to 0 or 1. The initial *pRes value
** will be 1 if the cursor being stepped corresponds to an SQL index and ** will be 1 if the cursor being stepped corresponds to an SQL index and
@@ -5283,7 +5287,7 @@ static int allocateBtreePage(
memcpy(&aData[8+closest*4], &aData[4+k*4], 4); memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
} }
put4byte(&aData[4], k-1); put4byte(&aData[4], k-1);
noContent = !btreeGetHasContent(pBt, *pPgno) ? PAGER_GET_NOCONTENT : 0; noContent = !btreeGetHasContent(pBt, *pPgno)? PAGER_GET_NOCONTENT : 0;
rc = btreeGetPage(pBt, *pPgno, ppPage, noContent); rc = btreeGetPage(pBt, *pPgno, ppPage, noContent);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3PagerWrite((*ppPage)->pDbPage); rc = sqlite3PagerWrite((*ppPage)->pDbPage);
@@ -5316,7 +5320,7 @@ static int allocateBtreePage(
** here are confined to those pages that lie between the end of the ** here are confined to those pages that lie between the end of the
** database image and the end of the database file. ** database image and the end of the database file.
*/ */
int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate)) ? PAGER_GET_NOCONTENT : 0; int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate))? PAGER_GET_NOCONTENT:0;
rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
if( rc ) return rc; if( rc ) return rc;
@@ -7089,7 +7093,8 @@ int sqlite3BtreeInsert(
} }
assert( cursorHoldsMutex(pCur) ); assert( cursorHoldsMutex(pCur) );
assert( (pCur->curFlags & BTCF_WriteFlag)!=0 && pBt->inTransaction==TRANS_WRITE assert( (pCur->curFlags & BTCF_WriteFlag)!=0
&& pBt->inTransaction==TRANS_WRITE
&& (pBt->btsFlags & BTS_READ_ONLY)==0 ); && (pBt->btsFlags & BTS_READ_ONLY)==0 );
assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
@@ -7122,7 +7127,8 @@ int sqlite3BtreeInsert(
/* If the cursor is currently on the last row and we are appending a /* If the cursor is currently on the last row and we are appending a
** new row onto the end, set the "loc" to avoid an unnecessary btreeMoveto() ** new row onto the end, set the "loc" to avoid an unnecessary btreeMoveto()
** call */ ** call */
if( (pCur->curFlags&BTCF_ValidNKey)!=0 && nKey>0 && pCur->info.nKey==nKey-1 ){ if( (pCur->curFlags&BTCF_ValidNKey)!=0 && nKey>0
&& pCur->info.nKey==nKey-1 ){
loc = -1; loc = -1;
} }
} }
@@ -8144,7 +8150,7 @@ static int checkTreePage(
checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext); checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
} }
#endif #endif
d2 = checkTreePage(pCheck, pgno, zContext, &nMinKey, i==0 ? NULL : &nMaxKey); d2 = checkTreePage(pCheck, pgno, zContext, &nMinKey, i==0?NULL:&nMaxKey);
if( i>0 && d2!=depth ){ if( i>0 && d2!=depth ){
checkAppendMsg(pCheck, zContext, "Child page depth differs"); checkAppendMsg(pCheck, zContext, "Child page depth differs");
} }
@@ -8161,7 +8167,7 @@ static int checkTreePage(
checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext); checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
} }
#endif #endif
checkTreePage(pCheck, pgno, zContext, NULL, !pPage->nCell ? NULL : &nMaxKey); checkTreePage(pCheck, pgno, zContext, NULL, !pPage->nCell?NULL:&nMaxKey);
} }
/* For intKey leaf pages, check that the min/max keys are in order /* For intKey leaf pages, check that the min/max keys are in order
@@ -8554,7 +8560,7 @@ int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){
** required in case any of them are holding references to an xFetch ** required in case any of them are holding references to an xFetch
** version of the b-tree page modified by the accessPayload call below. ** version of the b-tree page modified by the accessPayload call below.
** **
** Note that pCsr must be open on a BTREE_INTKEY table and saveCursorPosition() ** Note that pCsr must be open on a INTKEY table and saveCursorPosition()
** and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence ** and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence
** saveAllCursors can only return SQLITE_OK. ** saveAllCursors can only return SQLITE_OK.
*/ */