From: drh Date: Wed, 24 Sep 2014 02:05:41 +0000 (+0000) Subject: Have the clearCell() routine return the cell size to the caller, rather X-Git-Tag: version-3.8.7~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9bfdc250622df58dd87e34566ccb23d5910b40a6;p=thirdparty%2Fsqlite.git Have the clearCell() routine return the cell size to the caller, rather than have the caller make a separate call to cellSizePtr(). FossilOrigin-Name: f21d217583c205dc17f98bb4877fd4ed98cefcb1 --- diff --git a/manifest b/manifest index a69f68fbf0..209072a802 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Shorten\sall\slines\sof\ssource\scode\sin\sbtree.c\sto\sat\smost\s80\scharacters.\nNo\slogical\schanges. -D 2014-09-24T01:23:00.817 +C Have\sthe\sclearCell()\sroutine\sreturn\sthe\scell\ssize\sto\sthe\scaller,\srather\nthan\shave\sthe\scaller\smake\sa\sseparate\scall\sto\scellSizePtr(). +D 2014-09-24T02:05:41.968 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -172,7 +172,7 @@ F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2 F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 -F src/btree.c 3732a278d80867b06f8ed3dfa95338d021f874b0 +F src/btree.c 183d62b37358f95d2ffac796f8491591a3456362 F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8 F src/btreeInt.h 9db0d303b203d18871dc9a1d78a3e1ae4d62c1ef F src/build.c 8dbca25988045fbf2a33c9631c42706fa6449e60 @@ -1200,7 +1200,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8e3375313ebbf26b68561f3ed31d2a488222e5d0 -R 7f460f85115b9f5ff284729f30ee857e +P 5dd41cdbfebdd088ebd9a90a394ee296c207ad90 +R c3c34442c09fda273806b002932cda25 U drh -Z 15056c33153d13d2de1255f45fb692fc +Z 4d0ec3d41d82b7fff44b33f0ea314f2b diff --git a/manifest.uuid b/manifest.uuid index 57ede99673..1ee8b65c87 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5dd41cdbfebdd088ebd9a90a394ee296c207ad90 \ No newline at end of file +f21d217583c205dc17f98bb4877fd4ed98cefcb1 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index b943751253..9af99dd8ad 100644 --- a/src/btree.c +++ b/src/btree.c @@ -5519,9 +5519,15 @@ static void freePage(MemPage *pPage, int *pRC){ } /* -** Free any overflow pages associated with the given Cell. -*/ -static int clearCell(MemPage *pPage, unsigned char *pCell){ +** Free any overflow pages associated with the given Cell. Write the +** local Cell size (the number of bytes on the original page, omitting +** overflow) into *pnSize. +*/ +static int clearCell( + MemPage *pPage, /* The page that contains the Cell */ + unsigned char *pCell, /* First byte of the Cell */ + u16 *pnSize /* Write the size of the Cell here */ +){ BtShared *pBt = pPage->pBt; CellInfo info; Pgno ovflPgno; @@ -5531,6 +5537,7 @@ static int clearCell(MemPage *pPage, unsigned char *pCell){ assert( sqlite3_mutex_held(pPage->pBt->mutex) ); btreeParseCellPtr(pPage, pCell, &info); + *pnSize = info.nSize; if( info.iOverflow==0 ){ return SQLITE_OK; /* No overflow pages. Return without doing anything */ } @@ -7166,8 +7173,7 @@ int sqlite3BtreeInsert( if( !pPage->leaf ){ memcpy(newCell, oldCell, 4); } - szOld = cellSizePtr(pPage, oldCell); - rc = clearCell(pPage, oldCell); + rc = clearCell(pPage, oldCell, &szOld); dropCell(pPage, idx, szOld, &rc); if( rc ) goto end_insert; }else if( loc<0 && pPage->nCell>0 ){ @@ -7229,6 +7235,7 @@ int sqlite3BtreeDelete(BtCursor *pCur){ unsigned char *pCell; /* Pointer to cell to delete */ int iCellIdx; /* Index of cell to delete */ int iCellDepth; /* Depth of node containing pCell */ + u16 szCell; /* Size of the cell being deleted */ assert( cursorHoldsMutex(pCur) ); assert( pBt->inTransaction==TRANS_WRITE ); @@ -7277,8 +7284,8 @@ int sqlite3BtreeDelete(BtCursor *pCur){ rc = sqlite3PagerWrite(pPage->pDbPage); if( rc ) return rc; - rc = clearCell(pPage, pCell); - dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell), &rc); + rc = clearCell(pPage, pCell, &szCell); + dropCell(pPage, iCellIdx, szCell, &rc); if( rc ) return rc; /* If the cell deleted was not located on a leaf page, then the cursor @@ -7510,6 +7517,7 @@ static int clearDatabasePage( unsigned char *pCell; int i; int hdr; + u16 szCell; assert( sqlite3_mutex_held(pBt->mutex) ); if( pgno>btreePagecount(pBt) ){ @@ -7525,7 +7533,7 @@ static int clearDatabasePage( rc = clearDatabasePage(pBt, get4byte(pCell), 1, pnChange); if( rc ) goto cleardatabasepage_out; } - rc = clearCell(pPage, pCell); + rc = clearCell(pPage, pCell, &szCell); if( rc ) goto cleardatabasepage_out; } if( !pPage->leaf ){