/ Check-in [069337a9]
Login

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

Overview
Comment:Add an #ifdef and an ALWAYS() for coverage.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 069337a922867ad0d023f5bf36e13ea46e047000
User & Date: drh 2016-03-09 02:03:03
Context
2016-03-09
02:12
Change a branch made obsolete by recent parser enhancements into an assert(). check-in: ee486ef7 user: drh tags: trunk
02:03
Add an #ifdef and an ALWAYS() for coverage. check-in: 069337a9 user: drh tags: trunk
2016-03-08
23:44
Change an unreachable branch in the virtual table query planner into an assert(). check-in: 73b97b9e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/memjournal.c.

   198    198     else{
   199    199       /* An in-memory journal file should only ever be appended to. Random
   200    200       ** access writes are not required. The only exception to this is when
   201    201       ** the in-memory journal is being used by a connection using the
   202    202       ** atomic-write optimization. In this case the first 28 bytes of the
   203    203       ** journal file may be written as part of committing the transaction. */ 
   204    204       assert( iOfst==p->endpoint.iOffset || iOfst==0 );
          205  +#ifdef SQLITE_ENABLE_ATOMIC_WRITE
   205    206       if( iOfst==0 && p->pFirst ){
   206    207         assert( p->nChunkSize>iAmt );
   207    208         memcpy((u8*)p->pFirst->zChunk, zBuf, iAmt);
   208         -    }else{
          209  +    }else
          210  +#else
          211  +    assert( iOfst>0 || p->pFirst==0 );
          212  +#endif
          213  +    {
   209    214         while( nWrite>0 ){
   210    215           FileChunk *pChunk = p->endpoint.pChunk;
   211    216           int iChunkOffset = (int)(p->endpoint.iOffset%p->nChunkSize);
   212    217           int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset);
   213    218   
   214    219           if( iChunkOffset==0 ){
   215    220             /* New chunk is required to extend the file. */
................................................................................
   245    250   **
   246    251   ** If the journal file is already on disk, truncate it there. Or, if it
   247    252   ** is still in main memory but is being truncated to zero bytes in size,
   248    253   ** ignore 
   249    254   */
   250    255   static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
   251    256     MemJournal *p = (MemJournal *)pJfd;
   252         -  if( size==0 ){
          257  +  if( ALWAYS(size==0) ){
   253    258       memjrnlFreeChunks(p);
   254    259       p->nSize = 0;
   255    260       p->endpoint.pChunk = 0;
   256    261       p->endpoint.iOffset = 0;
   257    262       p->readpoint.pChunk = 0;
   258    263       p->readpoint.iOffset = 0;
   259    264     }