From: drh Date: Wed, 14 Sep 2011 13:23:21 +0000 (+0000) Subject: Remove code from vdbesort.c that was made unreachable by the recent X-Git-Tag: version-3.7.8~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=59ebc99161ef440a4e80f29300feab9ffc273021;p=thirdparty%2Fsqlite.git Remove code from vdbesort.c that was made unreachable by the recent sqlite3VdbeRecordUnpack() optimizations. FossilOrigin-Name: 607aba6cd7020973200fa376cf8df55360165266 --- diff --git a/manifest b/manifest index 3d19495e11..dbc1415331 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allocate\sthe\scorrect\ssize\sfor\sthe\soutput\sbuffer\sin\sfts3DoclistOrMerge().\sFix\sfor\s[56be976859]. -D 2011-09-13T19:08:43.953 +C Remove\scode\sfrom\svdbesort.c\sthat\swas\smade\sunreachable\sby\sthe\srecent\nsqlite3VdbeRecordUnpack()\soptimizations. +D 2011-09-14T13:23:21.875 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -245,7 +245,7 @@ F src/vdbeapi.c 11dc47987abacb76ad016dcf5abc0dc422482a98 F src/vdbeaux.c 079d37d4afac8359b2bbbf4af9876be04cc857b8 F src/vdbeblob.c f024f0bf420f36b070143c32b15cc7287341ffd3 F src/vdbemem.c 5e6effb96dd53d233361cbfaa3f0a43b9af689e9 -F src/vdbesort.c 667bc65254a9ebaf7bc466ebb7e58884933e351f +F src/vdbesort.c df1953a4929c4e82603d67ee7e5f6703f8a9135e F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114 F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582 F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9 @@ -961,7 +961,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P a9db247b752bcda0131b8f01c6f0182f3101d154 -R d155e7b5d9350f72a6fc8ad44a77ee3c -U dan -Z 8c4428f39d0d1ba0e8478a40bc187eaf +P 07788c0f7f3740c1c280f6ce4dc68401c30bae6e +R 10acdf81d291f1b22f3bc7924f505649 +U drh +Z eeb8c9d9c6395f39be328ccc4c54c823 diff --git a/manifest.uuid b/manifest.uuid index 63b21a1019..aa441de2ac 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -07788c0f7f3740c1c280f6ce4dc68401c30bae6e \ No newline at end of file +607aba6cd7020973200fa376cf8df55360165266 \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index ead2f453e4..0a8ec81220 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -298,7 +298,7 @@ static int vdbeSorterIterInit( ** If pKey2 is passed a NULL pointer, then it is assumed that the pCsr->aSpace ** has been allocated and contains an unpacked record that is used as key2. */ -static int vdbeSorterCompare( +static void vdbeSorterCompare( VdbeCursor *pCsr, /* Cursor object (for pKeyInfo) */ int bOmitRowid, /* Ignore rowid field at end of keys */ void *pKey1, int nKey1, /* Left side of comparison */ @@ -320,14 +320,13 @@ static int vdbeSorterCompare( for(i=0; inField; i++){ if( r2->aMem[i].flags & MEM_Null ){ *pRes = -1; - return SQLITE_OK; + return; } } r2->flags |= UNPACKED_PREFIX_MATCH; } *pRes = sqlite3VdbeRecordCompare(nKey1, pKey1, r2); - return SQLITE_OK; } /* @@ -362,15 +361,10 @@ static int vdbeSorterDoCompare(VdbeCursor *pCsr, int iOut){ iRes = i1; }else{ int res; - int rc; assert( pCsr->pSorter->pUnpacked!=0 ); /* allocated in vdbeSorterMerge() */ - rc = vdbeSorterCompare( + vdbeSorterCompare( pCsr, 0, p1->aKey, p1->nKey, p2->aKey, p2->nKey, &res ); - /* The vdbeSorterCompare() call cannot fail since pCsr->pSorter->pUnpacked - ** has already been allocated. */ - assert( rc==SQLITE_OK ); - if( res<=0 ){ iRes = i1; }else{ @@ -462,32 +456,23 @@ static int vdbeSorterOpenTempFile(sqlite3 *db, sqlite3_file **ppFile){ } /* -** Attemp to merge the two sorted lists p1 and p2 into a single list. If no -** error occurs set *ppOut to the head of the new list and return SQLITE_OK. +** Merge the two sorted lists p1 and p2 into a single list. +** Set *ppOut to the head of the new list. */ -static int vdbeSorterMerge( +static void vdbeSorterMerge( sqlite3 *db, /* Database handle */ VdbeCursor *pCsr, /* For pKeyInfo */ SorterRecord *p1, /* First list to merge */ SorterRecord *p2, /* Second list to merge */ SorterRecord **ppOut /* OUT: Head of merged list */ ){ - int rc = SQLITE_OK; SorterRecord *pFinal = 0; SorterRecord **pp = &pFinal; void *pVal2 = p2 ? p2->pVal : 0; while( p1 && p2 ){ int res; - rc = vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res); - if( rc!=SQLITE_OK ){ - *pp = 0; - vdbeSorterRecordFree(db, p1); - vdbeSorterRecordFree(db, p2); - vdbeSorterRecordFree(db, pFinal); - *ppOut = 0; - return rc; - } + vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res); if( res<=0 ){ *pp = p1; pp = &p1->pNext; @@ -502,9 +487,7 @@ static int vdbeSorterMerge( } } *pp = p1 ? p1 : p2; - *ppOut = pFinal; - return SQLITE_OK; } /* @@ -513,7 +496,6 @@ static int vdbeSorterMerge( ** occurs. */ static int vdbeSorterSort(sqlite3 *db, VdbeCursor *pCsr){ - int rc = SQLITE_OK; int i; SorterRecord **aSlot; SorterRecord *p; @@ -528,30 +510,22 @@ static int vdbeSorterSort(sqlite3 *db, VdbeCursor *pCsr){ while( p ){ SorterRecord *pNext = p->pNext; p->pNext = 0; - for(i=0; rc==SQLITE_OK && aSlot[i]; i++){ - rc = vdbeSorterMerge(db, pCsr, p, aSlot[i], &p); + for(i=0; aSlot[i]; i++){ + vdbeSorterMerge(db, pCsr, p, aSlot[i], &p); aSlot[i] = 0; } - if( rc!=SQLITE_OK ){ - vdbeSorterRecordFree(db, pNext); - break; - } aSlot[i] = p; p = pNext; } p = 0; for(i=0; i<64; i++){ - if( rc==SQLITE_OK ){ - rc = vdbeSorterMerge(db, pCsr, p, aSlot[i], &p); - }else{ - vdbeSorterRecordFree(db, aSlot[i]); - } + vdbeSorterMerge(db, pCsr, p, aSlot[i], &p); } pSorter->pRecord = p; sqlite3_free(aSlot); - return rc; + return SQLITE_OK; } @@ -894,14 +868,12 @@ int sqlite3VdbeSorterCompare( Mem *pVal, /* Value to compare to current sorter key */ int *pRes /* OUT: Result of comparison */ ){ - int rc; VdbeSorter *pSorter = pCsr->pSorter; void *pKey; int nKey; /* Sorter key to compare pVal with */ pKey = vdbeSorterRowkey(pSorter, &nKey); - rc = vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes); - assert( rc!=SQLITE_OK || pVal->db->mallocFailed || (*pRes)<=0 ); - return rc; + vdbeSorterCompare(pCsr, 1, pVal->z, pVal->n, pKey, nKey, pRes); + return SQLITE_OK; } #endif /* #ifndef SQLITE_OMIT_MERGE_SORT */