mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-25 20:58:26 +03:00
Change sqlite3MallocClearFailed() calls to sqlite3ApiExit(), a better API. (CVS 2970)
FossilOrigin-Name: e0b022e5b2bfd272b4e25cd7a7b472206a118bbe
This commit is contained in:
@@ -1739,6 +1739,19 @@ int sqlite3_tsd_count = 0;
|
||||
# define TSD_COUNTER(N) /* no-op */
|
||||
#endif
|
||||
|
||||
#if 0 && defined(SQLITE_MEMDEBUG)
|
||||
static void *mallocThreadData(size_t nBytes){
|
||||
if( sqlite3_iMallocFail>=0 ){
|
||||
sqlite3_iMallocFail--;
|
||||
if( sqlite3_iMallocFail==0 ){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return sqlite3OsMalloc(nBytes);
|
||||
}
|
||||
#else
|
||||
#define mallocThreadData(x) sqlite3OsMalloc(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** If called with allocateFlag>0, then return a pointer to thread
|
||||
@@ -1778,7 +1791,7 @@ ThreadData *sqlite3UnixThreadSpecificData(int allocateFlag){
|
||||
pTsd = pthread_getspecific(key);
|
||||
if( allocateFlag>0 ){
|
||||
if( pTsd==0 ){
|
||||
pTsd = sqlite3OsMalloc(sizeof(zeroData));
|
||||
pTsd = mallocThreadData(sizeof(zeroData));
|
||||
if( pTsd ){
|
||||
*pTsd = zeroData;
|
||||
pthread_setspecific(key, pTsd);
|
||||
@@ -1797,7 +1810,7 @@ ThreadData *sqlite3UnixThreadSpecificData(int allocateFlag){
|
||||
static ThreadData *pTsd = 0;
|
||||
if( allocateFlag>0 ){
|
||||
if( pTsd==0 ){
|
||||
pTsd = sqlite3OsMalloc( sizeof(zeroData) );
|
||||
pTsd = mallocThreadData( sizeof(zeroData) );
|
||||
if( pTsd ){
|
||||
*pTsd = zeroData;
|
||||
TSD_COUNTER(+1);
|
||||
|
||||
Reference in New Issue
Block a user