SQLite

Check-in [9a592cf91c]
Login

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

Overview
Comment:Fix harmless compiler warnings.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9a592cf91c74b369bacf6a0e69d45f3e73dfdbce
User & Date: drh 2015-07-16 18:37:53.565
Context
2015-07-16
20:17
Fix compiler warnings in fts5 code. (check-in: e9bf275cd9 user: dan tags: trunk)
18:37
Fix harmless compiler warnings. (check-in: 9a592cf91c 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: b79a4affe4 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/pcache1.c.
261
262
263
264
265
266
267
268

269
270
271
272
273
274
275

276
277

278
279

280
281
282
283
284
285
286
261
262
263
264
265
266
267

268
269
270
271
272
273
274

275
276

277
278

279
280
281
282
283
284
285
286







-
+






-
+

-
+

-
+







}

/*
** Try to initialize the pCache->pFree and pCache->pBulk fields.  Return
** true if pCache->pFree ends up containing one or more free pages.
*/
static int pcache1InitBulk(PCache1 *pCache){
  int szBulk;
  i64 szBulk;
  char *zBulk;
  if( pcache1.nInitPage==0 ) return 0;
  /* Do not bother with a bulk allocation if the cache size very small */
  if( pCache->nMax<3 ) return 0;
  sqlite3BeginBenignMalloc();
  if( pcache1.nInitPage>0 ){
    szBulk = pCache->szAlloc * pcache1.nInitPage;
    szBulk = pCache->szAlloc * (i64)pcache1.nInitPage;
  }else{
    szBulk = -1024*pcache1.nInitPage;
    szBulk = -1024 * (i64)pcache1.nInitPage;
  }
  if( szBulk > pCache->szAlloc*pCache->nMax ){
  if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){
    szBulk = pCache->szAlloc*pCache->nMax;
  }
  zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
  sqlite3EndBenignMalloc();
  if( zBulk ){
    int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
    int i;