/ Check-in [9a592cf9]
Login

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

Overview
Comment:Fix harmless compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9a592cf91c74b369bacf6a0e69d45f3e73dfdbce
User & Date: drh 2015-07-16 18:37:53
Context
2015-07-16
20:17
Fix compiler warnings in fts5 code. check-in: e9bf275c user: dan tags: trunk
18:37
Fix harmless compiler warnings. check-in: 9a592cf9 user: drh tags: trunk
18:18
Defer the bulk pcache1 memory allocation until the first page allocation request. Limit the size of the pcache1 bulk allocation to the cache_size setting. Deallocate the bulk allocation on a sqlite3_db_release_memory() request, if the bulk allocation is completely unused. check-in: b79a4aff user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pcache1.c.

   261    261   }
   262    262   
   263    263   /*
   264    264   ** Try to initialize the pCache->pFree and pCache->pBulk fields.  Return
   265    265   ** true if pCache->pFree ends up containing one or more free pages.
   266    266   */
   267    267   static int pcache1InitBulk(PCache1 *pCache){
   268         -  int szBulk;
          268  +  i64 szBulk;
   269    269     char *zBulk;
   270    270     if( pcache1.nInitPage==0 ) return 0;
   271    271     /* Do not bother with a bulk allocation if the cache size very small */
   272    272     if( pCache->nMax<3 ) return 0;
   273    273     sqlite3BeginBenignMalloc();
   274    274     if( pcache1.nInitPage>0 ){
   275         -    szBulk = pCache->szAlloc * pcache1.nInitPage;
          275  +    szBulk = pCache->szAlloc * (i64)pcache1.nInitPage;
   276    276     }else{
   277         -    szBulk = -1024*pcache1.nInitPage;
          277  +    szBulk = -1024 * (i64)pcache1.nInitPage;
   278    278     }
   279         -  if( szBulk > pCache->szAlloc*pCache->nMax ){
          279  +  if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){
   280    280       szBulk = pCache->szAlloc*pCache->nMax;
   281    281     }
   282    282     zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
   283    283     sqlite3EndBenignMalloc();
   284    284     if( zBulk ){
   285    285       int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
   286    286       int i;