mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Remove some dead code. Fix a faulty assert(). Improve some variable names.
FossilOrigin-Name: a9a64592cf88580cb254fb0aac65a2f2085976ec
This commit is contained in:
20
manifest
20
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Combine\stwo\smalloc\scalls\sin\svdbesort.c.
|
C Remove\ssome\sdead\scode.\s\sFix\sa\sfaulty\sassert().\s\sImprove\ssome\svariable\snames.
|
||||||
D 2011-09-02T18:03:16.975
|
D 2011-09-02T21:42:33.425
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505
|
F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -124,7 +124,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
|||||||
F src/backup.c 28a4fe55327ff708bfaf9d4326d02686f7a553c3
|
F src/backup.c 28a4fe55327ff708bfaf9d4326d02686f7a553c3
|
||||||
F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
|
F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
|
||||||
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||||
F src/btree.c dc3f244447fd5aade08f66d475e2a6316bbef4e7
|
F src/btree.c 4d46fe30b8bc920f68b7d58a5f45316fa5d023ec
|
||||||
F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce
|
F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce
|
||||||
F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3
|
F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3
|
||||||
F src/build.c dc367138cb3625e6d42b389e05d7267aece5753c
|
F src/build.c dc367138cb3625e6d42b389e05d7267aece5753c
|
||||||
@@ -167,8 +167,8 @@ F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
|||||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||||
F src/os_unix.c 10e0c4dcdbec8d4189890fdf3e71b32efae194e3
|
F src/os_unix.c 10e0c4dcdbec8d4189890fdf3e71b32efae194e3
|
||||||
F src/os_win.c 45de13c6c3501cfd6469b2b34149b823060e39f4
|
F src/os_win.c 45de13c6c3501cfd6469b2b34149b823060e39f4
|
||||||
F src/pager.c 817f7f7140c9fa2641f28e6330e924708ddd870d
|
F src/pager.c 5545863e4e246e1744cfb6993821c6e4b63ffb64
|
||||||
F src/pager.h 2bab1b2ea4eac58663b5833e3522e36b5ff63447
|
F src/pager.h 6bea8d1949db33768de1c5b4133b267b40845f8b
|
||||||
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
||||||
F src/pcache.c 49e718c095810c6b3334e3a6d89970aceaddefce
|
F src/pcache.c 49e718c095810c6b3334e3a6d89970aceaddefce
|
||||||
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
|
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
|
||||||
@@ -245,7 +245,7 @@ F src/vdbeapi.c 11dc47987abacb76ad016dcf5abc0dc422482a98
|
|||||||
F src/vdbeaux.c e58acbc5ea3823922a0cd8fa21f94f39af51ee88
|
F src/vdbeaux.c e58acbc5ea3823922a0cd8fa21f94f39af51ee88
|
||||||
F src/vdbeblob.c f024f0bf420f36b070143c32b15cc7287341ffd3
|
F src/vdbeblob.c f024f0bf420f36b070143c32b15cc7287341ffd3
|
||||||
F src/vdbemem.c 5e6effb96dd53d233361cbfaa3f0a43b9af689e9
|
F src/vdbemem.c 5e6effb96dd53d233361cbfaa3f0a43b9af689e9
|
||||||
F src/vdbesort.c b56437b8b3a0a17a2b110d37633dc9217c72fd60
|
F src/vdbesort.c 2ae618bec4bec5faa075e82078008763666c655d
|
||||||
F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114
|
F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114
|
||||||
F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582
|
F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582
|
||||||
F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9
|
F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9
|
||||||
@@ -961,7 +961,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
|
|||||||
F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2
|
F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2
|
||||||
P 065b0c9858da0ebb41722f3c56bdaf62f28b2f2c
|
P cf48ad8353e28339d00f448bb729e10a7f2aad72
|
||||||
R 06bb7ef7ee2f3a8f904497ea31ee4edb
|
R d2091eb5dd8da1e99612b5b3cd229b4c
|
||||||
U dan
|
U drh
|
||||||
Z ad89820409358feeee63c15f85c9298f
|
Z e655a0d761c2ed1b9d5806522d72983b
|
||||||
|
@@ -1 +1 @@
|
|||||||
cf48ad8353e28339d00f448bb729e10a7f2aad72
|
a9a64592cf88580cb254fb0aac65a2f2085976ec
|
@@ -7285,7 +7285,6 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){
|
int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){
|
||||||
BtShared *pBt = p->pBt;
|
|
||||||
int rc;
|
int rc;
|
||||||
sqlite3BtreeEnter(p);
|
sqlite3BtreeEnter(p);
|
||||||
rc = btreeDropTable(p, iTable, piMoved);
|
rc = btreeDropTable(p, iTable, piMoved);
|
||||||
|
27
src/pager.c
27
src/pager.c
@@ -621,7 +621,6 @@ struct Pager {
|
|||||||
u8 readOnly; /* True for a read-only database */
|
u8 readOnly; /* True for a read-only database */
|
||||||
u8 memDb; /* True to inhibit all file I/O */
|
u8 memDb; /* True to inhibit all file I/O */
|
||||||
u8 hasSeenStress; /* pagerStress() called one or more times */
|
u8 hasSeenStress; /* pagerStress() called one or more times */
|
||||||
u8 isSorter; /* True for a PAGER_SORTER */
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
** The following block contains those class members that change during
|
** The following block contains those class members that change during
|
||||||
@@ -845,15 +844,6 @@ static int assert_pager_state(Pager *p){
|
|||||||
assert( pagerUseWal(p)==0 );
|
assert( pagerUseWal(p)==0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A sorter is a temp file that never spills to disk and always has
|
|
||||||
** the doNotSpill flag set
|
|
||||||
*/
|
|
||||||
if( p->isSorter ){
|
|
||||||
assert( p->tempFile );
|
|
||||||
assert( p->doNotSpill );
|
|
||||||
assert( p->fd->pMethods==0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If changeCountDone is set, a RESERVED lock or greater must be held
|
/* If changeCountDone is set, a RESERVED lock or greater must be held
|
||||||
** on the file.
|
** on the file.
|
||||||
*/
|
*/
|
||||||
@@ -4557,12 +4547,6 @@ int sqlite3PagerOpen(
|
|||||||
/* pPager->pBusyHandlerArg = 0; */
|
/* pPager->pBusyHandlerArg = 0; */
|
||||||
pPager->xReiniter = xReinit;
|
pPager->xReiniter = xReinit;
|
||||||
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
|
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
|
||||||
#ifndef SQLITE_OMIT_MERGE_SORT
|
|
||||||
if( flags & PAGER_SORTER ){
|
|
||||||
pPager->doNotSpill = 1;
|
|
||||||
pPager->isSorter = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*ppPager = pPager;
|
*ppPager = pPager;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@@ -6107,17 +6091,6 @@ int sqlite3PagerIsMemdb(Pager *pPager){
|
|||||||
return MEMDB;
|
return MEMDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SQLITE_OMIT_MERGE_SORT
|
|
||||||
/*
|
|
||||||
** Return true if the pager has seen a pagerStress callback.
|
|
||||||
*/
|
|
||||||
int sqlite3PagerUnderStress(Pager *pPager){
|
|
||||||
assert( pPager->isSorter );
|
|
||||||
assert( pPager->doNotSpill );
|
|
||||||
return pPager->hasSeenStress;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Check that there are at least nSavepoint savepoints open. If there are
|
** Check that there are at least nSavepoint savepoints open. If there are
|
||||||
** currently less than nSavepoints open, then open one or more savepoints
|
** currently less than nSavepoints open, then open one or more savepoints
|
||||||
|
@@ -156,9 +156,6 @@ const char *sqlite3PagerJournalname(Pager*);
|
|||||||
int sqlite3PagerNosync(Pager*);
|
int sqlite3PagerNosync(Pager*);
|
||||||
void *sqlite3PagerTempSpace(Pager*);
|
void *sqlite3PagerTempSpace(Pager*);
|
||||||
int sqlite3PagerIsMemdb(Pager*);
|
int sqlite3PagerIsMemdb(Pager*);
|
||||||
#ifndef SQLITE_OMIT_MERGE_SORT
|
|
||||||
int sqlite3PagerUnderStress(Pager*);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Functions used to truncate the database file. */
|
/* Functions used to truncate the database file. */
|
||||||
void sqlite3PagerTruncateImage(Pager*,Pgno);
|
void sqlite3PagerTruncateImage(Pager*,Pgno);
|
||||||
|
@@ -102,8 +102,8 @@ struct VdbeSorter {
|
|||||||
sqlite3_file *pTemp1; /* PMA file 1 */
|
sqlite3_file *pTemp1; /* PMA file 1 */
|
||||||
int nPMA; /* Number of PMAs stored in pTemp1 */
|
int nPMA; /* Number of PMAs stored in pTemp1 */
|
||||||
SorterRecord *pRecord; /* Head of in-memory record list */
|
SorterRecord *pRecord; /* Head of in-memory record list */
|
||||||
int nLimit1; /* Minimum PMA size, in bytes */
|
int mnPmaSize; /* Minimum PMA size, in bytes */
|
||||||
int nLimit2; /* Maximum PMA size, in bytes */
|
int mxPmaSize; /* Maximum PMA size, in bytes. 0==no limit */
|
||||||
char *aSpace; /* Space for UnpackRecord() */
|
char *aSpace; /* Space for UnpackRecord() */
|
||||||
int nSpace; /* Size of aSpace in bytes */
|
int nSpace; /* Size of aSpace in bytes */
|
||||||
};
|
};
|
||||||
@@ -400,16 +400,20 @@ static int vdbeSorterDoCompare(VdbeCursor *pCsr, int iOut){
|
|||||||
*/
|
*/
|
||||||
int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){
|
int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){
|
||||||
int pgsz; /* Page size of main database */
|
int pgsz; /* Page size of main database */
|
||||||
|
int mxCache; /* Cache size */
|
||||||
|
VdbeSorter *pSorter; /* The new sorter */
|
||||||
|
|
||||||
assert( pCsr->pKeyInfo && pCsr->pBt==0 );
|
assert( pCsr->pKeyInfo && pCsr->pBt==0 );
|
||||||
pCsr->pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter));
|
pCsr->pSorter = pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter));
|
||||||
if( pCsr->pSorter==0 ){
|
if( pSorter==0 ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
|
pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
|
||||||
pCsr->pSorter->nLimit1 = 10 * pgsz;
|
pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
|
||||||
pCsr->pSorter->nLimit2 = db->aDb[0].pSchema->cache_size * pgsz;
|
mxCache = db->aDb[0].pSchema->cache_size;
|
||||||
|
if( mxCache<SORTER_MIN_WORKING ) mxCache = SORTER_MIN_WORKING;
|
||||||
|
pSorter->mxPmaSize = mxCache * pgsz;
|
||||||
|
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
@@ -557,25 +561,6 @@ static int vdbeSorterSort(sqlite3 *db, VdbeCursor *pCsr){
|
|||||||
}
|
}
|
||||||
pSorter->pRecord = p;
|
pSorter->pRecord = p;
|
||||||
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
SorterRecord *pTmp1 = 0;
|
|
||||||
SorterRecord *pTmp2;
|
|
||||||
for(pTmp2=pSorter->pRecord; pTmp2 && rc==SQLITE_OK; pTmp2=pTmp2->pNext){
|
|
||||||
if( pTmp1 ){
|
|
||||||
int res;
|
|
||||||
rc = vdbeSorterCompare(pCsr,
|
|
||||||
0, pTmp1->pVal, pTmp1->nVal, pTmp2->pVal, pTmp2->nVal, &res
|
|
||||||
);
|
|
||||||
assert( rc!=SQLITE_OK || res<0 );
|
|
||||||
}
|
|
||||||
pTmp1 = pTmp2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( rc!=SQLITE_OK ){
|
|
||||||
}
|
|
||||||
sqlite3_free(aSlot);
|
sqlite3_free(aSlot);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -682,8 +667,8 @@ int sqlite3VdbeSorterWrite(
|
|||||||
** than (page-size * 10) and sqlite3HeapNearlyFull() returns true.
|
** than (page-size * 10) and sqlite3HeapNearlyFull() returns true.
|
||||||
*/
|
*/
|
||||||
if( rc==SQLITE_OK && (
|
if( rc==SQLITE_OK && (
|
||||||
(pSorter->nInMemory>pSorter->nLimit2)
|
(pSorter->nInMemory>pSorter->mxPmaSize)
|
||||||
|| (pSorter->nInMemory>pSorter->nLimit1 && sqlite3HeapNearlyFull())
|
|| (pSorter->nInMemory>pSorter->mnPmaSize && sqlite3HeapNearlyFull())
|
||||||
)){
|
)){
|
||||||
rc = vdbeSorterListToPMA(db, pCsr);
|
rc = vdbeSorterListToPMA(db, pCsr);
|
||||||
pSorter->nInMemory = 0;
|
pSorter->nInMemory = 0;
|
||||||
@@ -920,7 +905,7 @@ int sqlite3VdbeSorterCompare(
|
|||||||
|
|
||||||
pKey = vdbeSorterRowkey(pSorter, &nKey);
|
pKey = vdbeSorterRowkey(pSorter, &nKey);
|
||||||
rc = vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);
|
rc = vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes);
|
||||||
assert( rc!=SQLITE_OK || *pRes<=0 );
|
assert( rc!=SQLITE_OK || pVal->db->mallocFailed || (*pRes)<=0 );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user