/ Check-in [89ee5295]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:When an assignment occurs in a boolean, always test the result using "!=0" to avoid confusion and make it clear that assignment is intended, not an equality test. Ticket #3491. (CVS 5879)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 89ee5295bdea6f2c093eb6a44d69917dcc8459e3
User & Date: drh 2008-11-11 00:36:17
Context
2008-11-11
15:48
Avoid signed/unsigned comparison warnings in bitvec.c by changing the types of loop variables to unsigned int. (CVS 5880) check-in: da869446 user: drh tags: trunk
00:36
When an assignment occurs in a boolean, always test the result using "!=0" to avoid confusion and make it clear that assignment is intended, not an equality test. Ticket #3491. (CVS 5879) check-in: 89ee5295 user: drh tags: trunk
00:30
Fix the CLI so that it does not terminate input when an Oracle or MS-SQL command terminator mark is seen in the middle of a string literal. Ticket #3490. (CVS 5878) check-in: 68662e3b user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pcache.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
...
936
937
938
939
940
941
942
943

944
945
946
947
948
949
950
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file implements that page cache.
**
** @(#) $Id: pcache.c,v 1.34 2008/10/17 18:51:53 danielk1977 Exp $
*/
#include "sqliteInt.h"

/*
** A complete page cache is an instance of this structure.
**
** A cache may only be deleted by its owner and while holding the
................................................................................
** A pointer to the recycled page is returned, or NULL if no page is
** eligible for recycling.
*/
static PgHdr *pcacheRecyclePage(void){
  PgHdr *p = 0;
  assert( sqlite3_mutex_held(pcache_g.mutex) );

  if( (p=pcache_g.pLruTail) ){
    assert( (p->flags&PGHDR_DIRTY)==0 );
    pcacheRemoveFromLruList(p);
    pcacheRemoveFromHash(p);
    pcacheRemoveFromList(&p->pCache->pClean, p);
  }

  return p;
................................................................................
/*
** If there are currently more than pcache.nMaxPage pages allocated, try
** to recycle pages to reduce the number allocated to pcache.nMaxPage.
*/
static void pcacheEnforceMaxPage(void){
  PgHdr *p;
  assert( sqlite3_mutex_held(pcache_g.mutex) );
  while( pcache_g.nCurrentPage>pcache_g.nMaxPage && (p = pcacheRecyclePage()) ){

    pcachePageFree(p);
  }
}

/*
** Close a cache.
*/







|







 







|







 







|
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
...
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file implements that page cache.
**
** @(#) $Id: pcache.c,v 1.35 2008/11/11 00:36:17 drh Exp $
*/
#include "sqliteInt.h"

/*
** A complete page cache is an instance of this structure.
**
** A cache may only be deleted by its owner and while holding the
................................................................................
** A pointer to the recycled page is returned, or NULL if no page is
** eligible for recycling.
*/
static PgHdr *pcacheRecyclePage(void){
  PgHdr *p = 0;
  assert( sqlite3_mutex_held(pcache_g.mutex) );

  if( (p=pcache_g.pLruTail)!=0 ){
    assert( (p->flags&PGHDR_DIRTY)==0 );
    pcacheRemoveFromLruList(p);
    pcacheRemoveFromHash(p);
    pcacheRemoveFromList(&p->pCache->pClean, p);
  }

  return p;
................................................................................
/*
** If there are currently more than pcache.nMaxPage pages allocated, try
** to recycle pages to reduce the number allocated to pcache.nMaxPage.
*/
static void pcacheEnforceMaxPage(void){
  PgHdr *p;
  assert( sqlite3_mutex_held(pcache_g.mutex) );
  while( pcache_g.nCurrentPage>pcache_g.nMaxPage
             && (p = pcacheRecyclePage())!=0 ){
    pcachePageFree(p);
  }
}

/*
** Close a cache.
*/