1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Fix a bug in pager.c introduced in the previous delta. (CVS 227)

FossilOrigin-Name: f4df6664037c68e1ce539c84c852124d95cd5a56
This commit is contained in:
drh
2001-06-23 11:36:20 +00:00
parent 8c42ca9366
commit df0b3b090e
3 changed files with 20 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
C The\sBTree\scode\scompiles\sand\slinks\snow,\sbut\sit\sdoes\snot\swork\syet.\s(CVS\s226) C Fix\sa\sbug\sin\spager.c\sintroduced\sin\sthe\sprevious\sdelta.\s(CVS\s227)
D 2001-06-22T19:15:00 D 2001-06-23T11:36:20
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 65862a30703b070209b5f5e565d75cc870962b3c F Makefile.in 65862a30703b070209b5f5e565d75cc870962b3c
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958 F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
@@ -31,7 +31,7 @@ F src/ex/sizes.tcl f54bad4a2ac567624be59131a6ee42d71b41a3d7
F src/expr.c c4c24c3af1eba094a816522eb0e085bed518ee16 F src/expr.c c4c24c3af1eba094a816522eb0e085bed518ee16
F src/insert.c aa528e20a787af85432a61daaea6df394bd251d7 F src/insert.c aa528e20a787af85432a61daaea6df394bd251d7
F src/main.c 0a13c7a2beb8ce36aee43daf8c95989b200727a7 F src/main.c 0a13c7a2beb8ce36aee43daf8c95989b200727a7
F src/pager.c 30c6f10a3c0cdfca3314c07d34375dbc19a48c2f F src/pager.c d5cb53ac679d039d40661e50200a8dde6406ca15
F src/pager.h 724ac5a79b5fa704a1e1a87e421e421b3da9c1e4 F src/pager.h 724ac5a79b5fa704a1e1a87e421e421b3da9c1e4
F src/parse.y 8fc096948994a7ffbf61ba13129cc589f794a9cb F src/parse.y 8fc096948994a7ffbf61ba13129cc589f794a9cb
F src/printf.c b1e22a47be8cdf707815647239991e08e8cb69f9 F src/printf.c b1e22a47be8cdf707815647239991e08e8cb69f9
@@ -107,7 +107,7 @@ F www/opcode.tcl cb3a1abf8b7b9be9f3a228d097d6bf8b742c2b6f
F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f
F www/tclsqlite.tcl 06f81c401f79a04f2c5ebfb97e7c176225c0aef2 F www/tclsqlite.tcl 06f81c401f79a04f2c5ebfb97e7c176225c0aef2
F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad
P d4be4709ee32bab6e78104861ed4e02d153779aa P b31c49021c260a67b7848bc077b75a7146e31c71
R 0a720e1f17d26fb5cb5699a653f8a269 R e52ea2ba0d86c859453a43591ceb35fc
U drh U drh
Z 4c2d9d4e753474964194e60669402b32 Z 86cec7512c643b5b976845158db125a4

View File

@@ -1 +1 @@
b31c49021c260a67b7848bc077b75a7146e31c71 f4df6664037c68e1ce539c84c852124d95cd5a56

View File

@@ -27,7 +27,7 @@
** all writes in order to support rollback. Locking is used to limit ** all writes in order to support rollback. Locking is used to limit
** access to one or more reader or one writer. ** access to one or more reader or one writer.
** **
** @(#) $Id: pager.c,v 1.9 2001/06/22 19:15:00 drh Exp $ ** @(#) $Id: pager.c,v 1.10 2001/06/23 11:36:20 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "pager.h" #include "pager.h"
@@ -562,8 +562,7 @@ Pgno sqlitepager_pagenumber(void *pData){
** currently on the freelist (the reference count is zero) then ** currently on the freelist (the reference count is zero) then
** remove it from the freelist. ** remove it from the freelist.
*/ */
int sqlitepager_ref(void *pData){ static void page_ref(PgHdr *pPg){
PgHdr *pPg = DATA_TO_PGHDR(pData);
if( pPg->nRef==0 ){ if( pPg->nRef==0 ){
/* The page is currently on the freelist. Remove it. */ /* The page is currently on the freelist. Remove it. */
if( pPg->pPrevFree ){ if( pPg->pPrevFree ){
@@ -579,6 +578,15 @@ int sqlitepager_ref(void *pData){
pPg->pPager->nRef++; pPg->pPager->nRef++;
} }
pPg->nRef++; pPg->nRef++;
}
/*
** Increment the reference count for a page. The input pointer is
** a reference to the page data.
*/
int sqlitepager_ref(void *pData){
PgHdr *pPg = DATA_TO_PGHDR(pData);
page_ref(pPg);
return SQLITE_OK; return SQLITE_OK;
} }
@@ -766,7 +774,7 @@ int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage){
}else{ }else{
/* The requested page is in the page cache. */ /* The requested page is in the page cache. */
pPager->nHit++; pPager->nHit++;
sqlitepager_ref(pPg); page_ref(pPg);
} }
*ppPage = PGHDR_TO_DATA(pPg); *ppPage = PGHDR_TO_DATA(pPg);
return SQLITE_OK; return SQLITE_OK;
@@ -799,7 +807,7 @@ void *sqlitepager_lookup(Pager *pPager, Pgno pgno){
} }
pPg = pager_lookup(pPager, pgno); pPg = pager_lookup(pPager, pgno);
if( pPg==0 ) return 0; if( pPg==0 ) return 0;
sqlitepager_ref(pPg); page_ref(pPg);
return PGHDR_TO_DATA(pPg); return PGHDR_TO_DATA(pPg);
} }