mirror of https://github.com/sqlite/sqlite
Simplifications and comment improvements to pager.c in support of coverage
testing. (CVS 6938) FossilOrigin-Name: 5b70b5c19cd587a8afbf2909ac7a4c04aea20f44
This commit is contained in:
parent
0b0abe45ca
commit
5e1fa03dca
12
manifest
12
manifest
|
@ -1,5 +1,5 @@
|
|||
C Add\sa\sNEVER()\son\san\salways-false\sconditional\sin\spager.c.\nMake\ssure\sthe\stext\sof\sthe\smaster\sjournal\sfile\sis\szero-terminated\sbefore\ntrying\sto\sprocess\sit\s-\sto\sprevent\sa\sbuffer\soverrun\sin\sstrlen().\s(CVS\s6937)
|
||||
D 2009-07-25T14:18:57
|
||||
C Simplifications\sand\scomment\simprovements\sto\spager.c\sin\ssupport\sof\scoverage\ntesting.\s(CVS\s6938)
|
||||
D 2009-07-25T15:24:14
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
|
@ -147,7 +147,7 @@ F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
|
|||
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
|
||||
F src/os_unix.c cdb2a08b9ce4aa13b3f7b91d4dd60fb48be9f56a
|
||||
F src/os_win.c 725c38a524d168ce280446ad8761d731bc516405
|
||||
F src/pager.c 23c9823d72b0213d7cbf3ca6e5aeb9735b467d5d
|
||||
F src/pager.c 9ba1c7412f5f8fc1c98d0662a81f3842b0995300
|
||||
F src/pager.h 11852d044c86cf5a9d6e34171fb0c4fcf1f6265f
|
||||
F src/parse.y bcd46d43fbd23a22b8c020a3eb1806b794794ed5
|
||||
F src/pcache.c c92ffd4f3e1279b3766854c6d18b5bf4aac0d1fa
|
||||
|
@ -738,7 +738,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
|
||||
P 03153831635342a744ee42f14cb041499cdece2a
|
||||
R 4106cc756a07d0d168a7b40655b87b37
|
||||
P cc9430e334fe98e1c35d408f81a2d8953377cda6
|
||||
R e5fb6459ed2755d7a158ac65e619d65e
|
||||
U drh
|
||||
Z 8238038a139f353098e7137beba5542a
|
||||
Z ab499bece38a6094beca9b024b831cb1
|
||||
|
|
|
@ -1 +1 @@
|
|||
cc9430e334fe98e1c35d408f81a2d8953377cda6
|
||||
5b70b5c19cd587a8afbf2909ac7a4c04aea20f44
|
21
src/pager.c
21
src/pager.c
|
@ -18,7 +18,7 @@
|
|||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.622 2009/07/25 14:18:57 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.623 2009/07/25 15:24:14 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
|
@ -1302,11 +1302,8 @@ static int pager_end_transaction(Pager *pPager, int hasMaster){
|
|||
|
||||
/* Finalize the journal file. */
|
||||
if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){
|
||||
int isMemoryJournal = sqlite3IsMemJournal(pPager->jfd);
|
||||
assert( sqlite3IsMemJournal(pPager->jfd) );
|
||||
sqlite3OsClose(pPager->jfd);
|
||||
if( !isMemoryJournal ){
|
||||
rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);
|
||||
}
|
||||
}else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){
|
||||
if( pPager->journalOff==0 ){
|
||||
rc = SQLITE_OK;
|
||||
|
@ -4211,6 +4208,11 @@ static int pager_write(PgHdr *pPg){
|
|||
Pager *pPager = pPg->pPager;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
/* This routine is not called unless a transaction has already been
|
||||
** started.
|
||||
*/
|
||||
assert( pPager->state>=PAGER_RESERVED );
|
||||
|
||||
/* If an error has been previously detected, we should not be
|
||||
** calling this routine. Repeat the error for robustness.
|
||||
*/
|
||||
|
@ -4236,15 +4238,14 @@ static int pager_write(PgHdr *pPg){
|
|||
** written to the transaction journal or the ckeckpoint journal
|
||||
** or both.
|
||||
**
|
||||
** First check to see that the transaction journal exists and
|
||||
** create it if it does not.
|
||||
** Higher level routines should have already started a transaction,
|
||||
** which means they have acquired the necessary locks and opened
|
||||
** a rollback journal. Double-check to makes sure this is the case.
|
||||
*/
|
||||
assert( pPager->state!=PAGER_UNLOCK );
|
||||
rc = sqlite3PagerBegin(pPager, 0, pPager->subjInMemory);
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( NEVER(rc!=SQLITE_OK) ){
|
||||
return rc;
|
||||
}
|
||||
assert( pPager->state>=PAGER_RESERVED );
|
||||
if( !isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
|
||||
assert( pPager->useJournal );
|
||||
rc = pager_open_journal(pPager);
|
||||
|
|
Loading…
Reference in New Issue