mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Use a global variable protected by a mutex instead of thread-specific-data to record malloc() failures. (CVS 2972)
FossilOrigin-Name: ac090f2ab3b5a792c2fdf897e10060f263e0d408
This commit is contained in:
25
src/build.c
25
src/build.c
@@ -22,7 +22,7 @@
|
||||
** COMMIT
|
||||
** ROLLBACK
|
||||
**
|
||||
** $Id: build.c,v 1.381 2006/01/16 15:14:28 danielk1977 Exp $
|
||||
** $Id: build.c,v 1.382 2006/01/18 16:51:35 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -130,7 +130,7 @@ void sqlite3FinishCoding(Parse *pParse){
|
||||
sqlite3 *db;
|
||||
Vdbe *v;
|
||||
|
||||
if( sqlite3ThreadDataReadOnly()->mallocFailed ) return;
|
||||
if( sqlite3MallocFailed() ) return;
|
||||
if( pParse->nested ) return;
|
||||
if( !pParse->pVdbe ){
|
||||
if( pParse->rc==SQLITE_OK && pParse->nErr ){
|
||||
@@ -1364,8 +1364,7 @@ void sqlite3EndTable(
|
||||
sqlite3 *db = pParse->db;
|
||||
int iDb;
|
||||
|
||||
if( (pEnd==0 && pSelect==0) ||
|
||||
pParse->nErr || sqlite3ThreadDataReadOnly()->mallocFailed ) {
|
||||
if( (pEnd==0 && pSelect==0) || pParse->nErr || sqlite3MallocFailed() ) {
|
||||
return;
|
||||
}
|
||||
p = pParse->pNewTable;
|
||||
@@ -1607,7 +1606,7 @@ void sqlite3CreateView(
|
||||
*/
|
||||
p->pSelect = sqlite3SelectDup(pSelect);
|
||||
sqlite3SelectDelete(pSelect);
|
||||
if( sqlite3ThreadDataReadOnly()->mallocFailed ){
|
||||
if( sqlite3MallocFailed() ){
|
||||
return;
|
||||
}
|
||||
if( !pParse->db->init.busy ){
|
||||
@@ -1849,7 +1848,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){
|
||||
sqlite3 *db = pParse->db;
|
||||
int iDb;
|
||||
|
||||
if( pParse->nErr || sqlite3ThreadDataReadOnly()->mallocFailed ){
|
||||
if( pParse->nErr || sqlite3MallocFailed() ){
|
||||
goto exit_drop_table;
|
||||
}
|
||||
assert( pName->nSrc==1 );
|
||||
@@ -2210,7 +2209,7 @@ void sqlite3CreateIndex(
|
||||
int nExtra = 0;
|
||||
char *zExtra;
|
||||
|
||||
if( pParse->nErr || sqlite3ThreadDataReadOnly()->mallocFailed ){
|
||||
if( pParse->nErr || sqlite3MallocFailed() ){
|
||||
goto exit_create_index;
|
||||
}
|
||||
|
||||
@@ -2364,7 +2363,7 @@ void sqlite3CreateIndex(
|
||||
nName + 1 + /* Index.zName */
|
||||
nExtra /* Collation sequence names */
|
||||
);
|
||||
if( sqlite3ThreadDataReadOnly()->mallocFailed ) goto exit_create_index;
|
||||
if( sqlite3MallocFailed() ) goto exit_create_index;
|
||||
pIndex->aiColumn = (int *)(&pIndex[1]);
|
||||
pIndex->aiRowEst = (unsigned *)(&pIndex->aiColumn[nCol]);
|
||||
pIndex->azColl = (char **)(&pIndex->aiRowEst[nCol+1]);
|
||||
@@ -2651,7 +2650,7 @@ void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){
|
||||
sqlite3 *db = pParse->db;
|
||||
int iDb;
|
||||
|
||||
if( pParse->nErr || sqlite3ThreadDataReadOnly()->mallocFailed ){
|
||||
if( pParse->nErr || sqlite3MallocFailed() ){
|
||||
goto exit_drop_index;
|
||||
}
|
||||
assert( pName->nSrc==1 );
|
||||
@@ -2860,7 +2859,7 @@ SrcList *sqlite3SrcListAppend(SrcList *pList, Token *pTable, Token *pDatabase){
|
||||
void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){
|
||||
int i;
|
||||
struct SrcList_item *pItem;
|
||||
assert(pList || sqlite3ThreadDataReadOnly()->mallocFailed);
|
||||
assert(pList || sqlite3MallocFailed() );
|
||||
if( pList ){
|
||||
for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
|
||||
if( pItem->iCursor>=0 ) break;
|
||||
@@ -2909,7 +2908,7 @@ void sqlite3BeginTransaction(Parse *pParse, int type){
|
||||
int i;
|
||||
|
||||
if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
|
||||
if( pParse->nErr || sqlite3ThreadDataReadOnly()->mallocFailed ) return;
|
||||
if( pParse->nErr || sqlite3MallocFailed() ) return;
|
||||
if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ) return;
|
||||
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
@@ -2930,7 +2929,7 @@ void sqlite3CommitTransaction(Parse *pParse){
|
||||
Vdbe *v;
|
||||
|
||||
if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
|
||||
if( pParse->nErr || sqlite3ThreadDataReadOnly()->mallocFailed ) return;
|
||||
if( pParse->nErr || sqlite3MallocFailed() ) return;
|
||||
if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ) return;
|
||||
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
@@ -2947,7 +2946,7 @@ void sqlite3RollbackTransaction(Parse *pParse){
|
||||
Vdbe *v;
|
||||
|
||||
if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
|
||||
if( pParse->nErr || sqlite3ThreadDataReadOnly()->mallocFailed ) return;
|
||||
if( pParse->nErr || sqlite3MallocFailed() ) return;
|
||||
if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ) return;
|
||||
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
|
||||
Reference in New Issue
Block a user