1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Some elements of the new malloc() failure handling. Not all cases work properly yet. Also, library is not threadsafe if malloc() fails right now. (CVS 2800)

FossilOrigin-Name: e1606658f1b4530e3001db4779b5669c8d13c853
This commit is contained in:
danielk1977
2005-12-06 12:52:59 +00:00
parent 67e0b84f7d
commit 261919cc16
30 changed files with 446 additions and 267 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.428 2005/11/14 22:29:05 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.429 2005/12/06 12:52:59 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -263,12 +263,6 @@ struct BusyHandler {
# define sqliteStrNDup sqlite3StrNDup
#endif
/*
** This variable gets set if malloc() ever fails. After it gets set,
** the SQLite library shuts down permanently.
*/
extern int sqlite3_malloc_failed;
/*
** The following global variables are used for testing and debugging
** only. They only work if SQLITE_DEBUG is defined.
@@ -1385,6 +1379,14 @@ typedef struct {
char **pzErrMsg; /* Error message stored here */
} InitData;
/*
** An instance of this structure is allocated for each thread that uses SQLite.
*/
typedef struct SqliteTsd SqliteTsd;
struct SqliteTsd {
int mallocFailed; /* True after a malloc() has failed */
};
/*
* This global flag is set for performance testing of triggers. When it is set
* SQLite will perform the overhead of building new and old trigger references
@@ -1674,6 +1676,8 @@ void sqlite3AnalysisLoad(sqlite3*,int iDB);
void sqlite3DefaultRowEst(Index*);
void sqlite3RegisterLikeFunctions(sqlite3*, int);
int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);
SqliteTsd *sqlite3Tsd();
void sqlite3ClearMallocFailed();
#ifdef SQLITE_SSE
#include "sseInt.h"