aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2006-01-18 15:25:17 +0000
committerdanielk1977 <danielk1977@noemail.net>2006-01-18 15:25:17 +0000
commit54f0198e47ef06ee7a4326ccc51d6a21ce8914d2 (patch)
treea8141acd8c4016502372e39d02c6603935ae5018 /src/os_unix.c
parent332b1feaf1067f317c2ee91ec39de1ed37e170c9 (diff)
downloadsqlite-54f0198e47ef06ee7a4326ccc51d6a21ce8914d2.tar.gz
sqlite-54f0198e47ef06ee7a4326ccc51d6a21ce8914d2.zip
Change sqlite3MallocClearFailed() calls to sqlite3ApiExit(), a better API. (CVS 2970)
FossilOrigin-Name: e0b022e5b2bfd272b4e25cd7a7b472206a118bbe
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 35d29ad3c..5257bfd5e 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -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);