/ Check-in [88cfe6d7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use #ifdef logic to avoid an always-true branch when SQLITE_MAX_WORKER_THREADS=0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | threads
Files: files | file ages | folders
SHA1: 88cfe6d7de5f19f484304d0db585eac5de6c00ae
User & Date: drh 2014-05-16 12:18:08
Context
2014-05-16
14:27
Merge all recent changes from trunk, and especially the new sqlite3FaultSim() interface. check-in: 43fcbd91 user: drh tags: threads
12:18
Use #ifdef logic to avoid an always-true branch when SQLITE_MAX_WORKER_THREADS=0 check-in: 88cfe6d7 user: drh tags: threads
2014-05-15
16:56
Use #ifdef to omit code that is not used when SQLITE_MAX_WORKER_THREADS is zero. check-in: 2e8d287d user: drh tags: threads
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbesort.c.

   825    825     int mxCache;                    /* Cache size */
   826    826     VdbeSorter *pSorter;            /* The new sorter */
   827    827     KeyInfo *pKeyInfo;              /* Copy of pCsr->pKeyInfo with db==0 */
   828    828     int szKeyInfo;                  /* Size of pCsr->pKeyInfo in bytes */
   829    829     int sz;                         /* Size of pSorter in bytes */
   830    830     int rc = SQLITE_OK;
   831    831   #if SQLITE_MAX_WORKER_THREADS==0
   832         -  const int nWorker = 0;
          832  +# define nWorker 0
   833    833   #else
   834    834     int nWorker = (sqlite3GlobalConfig.bCoreMutex?sqlite3GlobalConfig.nWorker:0);
   835    835   #endif
   836    836   
   837    837     assert( pCsr->pKeyInfo && pCsr->pBt==0 );
   838    838     szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nField-1)*sizeof(CollSeq*);
   839    839     sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
................................................................................
   875    875           if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM;
   876    876         }
   877    877       }
   878    878     }
   879    879   
   880    880     return rc;
   881    881   }
          882  +#undef nWorker   /* Defined at the top of this function */
   882    883   
   883    884   /*
   884    885   ** Free the list of sorted records starting at pRecord.
   885    886   */
   886    887   static void vdbeSorterRecordFree(sqlite3 *db, SorterRecord *pRecord){
   887    888     SorterRecord *p;
   888    889     SorterRecord *pNext;
................................................................................
  1802   1803   */
  1803   1804   static int vdbeIncrNew(
  1804   1805     SortSubtask *pTask, 
  1805   1806     MergeEngine *pMerger,
  1806   1807     IncrMerger **ppOut
  1807   1808   ){
  1808   1809     int rc = SQLITE_OK;
  1809         -  IncrMerger *pIncr = *ppOut = (IncrMerger*)sqlite3_malloc(sizeof(IncrMerger));
         1810  +  IncrMerger *pIncr = *ppOut = (IncrMerger*)sqlite3MallocZero(sizeof(*pIncr));
  1810   1811     if( pIncr ){
  1811         -    memset(pIncr, 0, sizeof(IncrMerger));
  1812   1812       pIncr->pMerger = pMerger;
  1813   1813       pIncr->pTask = pTask;
  1814   1814       pIncr->mxSz = MAX(pTask->pSorter->mxKeysize+9,pTask->pSorter->mxPmaSize/2);
  1815   1815       pTask->file2.iEof += pIncr->mxSz;
  1816   1816     }else{
  1817   1817       vdbeMergeEngineFree(pMerger);
  1818   1818       rc = SQLITE_NOMEM;