/ Check-in [85f3d80e]
Login

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

Overview
Comment:sqlite3PCachePerecentDirty() should return 0 if the pcache is empty.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tempfiles-25
Files: files | file ages | folders
SHA1:85f3d80eb7319754792eef76996b2c740a2b0073
User & Date: drh 2016-04-18 13:30:50
Context
2016-04-18
13:36
Merge recent trunk changes. check-in: d9768de5 user: drh tags: tempfiles-25
13:30
sqlite3PCachePerecentDirty() should return 0 if the pcache is empty. check-in: 85f3d80e user: drh tags: tempfiles-25
2016-04-13
19:20
Merge enhancements from trunk via tempfiles-lazy-open. check-in: ae16310c user: drh tags: tempfiles-25
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pcache.c.

   691    691   ** of the configured cache size.
   692    692   */
   693    693   int sqlite3PCachePercentDirty(PCache *pCache){
   694    694     PgHdr *pDirty;
   695    695     int nDirty = 0;
   696    696     int nCache = numberOfCachePages(pCache);
   697    697     for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext) nDirty++;
   698         -  return (int)(((i64)nDirty * 100) / nCache);
          698  +  return nCache ? (int)(((i64)nDirty * 100) / nCache) : 0;
   699    699   }
   700    700   
   701    701   #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
   702    702   /*
   703    703   ** For all dirty pages currently in the cache, invoke the specified
   704    704   ** callback. This is only used if the SQLITE_CHECK_PAGES macro is
   705    705   ** defined.