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

Change sqlite3MallocClearFailed() calls to sqlite3ApiExit(), a better API. (CVS 2970)

FossilOrigin-Name: e0b022e5b2bfd272b4e25cd7a7b472206a118bbe
This commit is contained in:
danielk1977
2006-01-18 15:25:17 +00:00
parent 332b1feaf1
commit 54f0198e47
12 changed files with 113 additions and 107 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.241 2006/01/16 15:32:23 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.242 2006/01/18 15:25:17 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -1577,7 +1577,15 @@ int sqlite3pager_open(
int noReadlock = (flags & PAGER_NO_READLOCK)!=0;
char zTemp[SQLITE_TEMPNAME_SIZE];
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
/* A malloc() cannot fail in sqlite3ThreadData() as one or more calls to
** malloc() must have already been made by this thread before it gets
** to this point. This means the ThreadData must have been allocated already
** so that ThreadData.nAlloc can be set. It would be nice to assert
** that ThreadData.nAlloc is non-zero, but alas this breaks test cases
** written to invoke the pager directly.
*/
ThreadData *pTsd = sqlite3ThreadData();
assert( pTsd );
#endif
/* If malloc() has already failed return SQLITE_NOMEM. Before even
@@ -1985,7 +1993,13 @@ int sqlite3pager_truncate(Pager *pPager, Pgno nPage){
int sqlite3pager_close(Pager *pPager){
PgHdr *pPg, *pNext;
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
/* A malloc() cannot fail in sqlite3ThreadData() as one or more calls to
** malloc() must have already been made by this thread before it gets
** to this point. This means the ThreadData must have been allocated already
** so that ThreadData.nAlloc can be set.
*/
ThreadData *pTsd = sqlite3ThreadData();
assert( pTsd && pTsd->nAlloc );
#endif
switch( pPager->state ){