aboutsummaryrefslogtreecommitdiff
path: root/src/malloc.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2007-05-16 17:28:43 +0000
committerdanielk1977 <danielk1977@noemail.net>2007-05-16 17:28:43 +0000
commit1cc5ed815011e57e4da392759ae7150e644d30bf (patch)
tree9944c0adbc6f9a0a826ca4fd05ced57a203b5f56 /src/malloc.c
parent246ad31db651a75d5d26aadbf13fb07d476906e6 (diff)
downloadsqlite-1cc5ed815011e57e4da392759ae7150e644d30bf.tar.gz
sqlite-1cc5ed815011e57e4da392759ae7150e644d30bf.zip
Change a few selected functions to macros to speed things up. (CVS 4015)
FossilOrigin-Name: 93f811ec747f6a42daf9ee27cd8b013f248552a1
Diffstat (limited to 'src/malloc.c')
-rw-r--r--src/malloc.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/malloc.c b/src/malloc.c
index 524f5ea60..e8124a34d 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -12,7 +12,7 @@
** Memory allocation functions used throughout sqlite.
**
**
-** $Id: malloc.c,v 1.1 2007/05/05 11:48:54 drh Exp $
+** $Id: malloc.c,v 1.2 2007/05/16 17:28:43 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -788,10 +788,10 @@ void sqlite3SetString(char **pz, ...){
** then the connection error-code (the value returned by sqlite3_errcode())
** is set to SQLITE_NOMEM.
*/
-static int mallocHasFailed = 0;
+int sqlite3_mallocHasFailed = 0;
int sqlite3ApiExit(sqlite3* db, int rc){
if( sqlite3MallocFailed() ){
- mallocHasFailed = 0;
+ sqlite3_mallocHasFailed = 0;
sqlite3OsLeaveMutex();
sqlite3Error(db, SQLITE_NOMEM, 0);
rc = SQLITE_NOMEM;
@@ -800,21 +800,13 @@ int sqlite3ApiExit(sqlite3* db, int rc){
}
/*
-** Return true is a malloc has failed in this thread since the last call
-** to sqlite3ApiExit(), or false otherwise.
-*/
-int sqlite3MallocFailed(){
- return (mallocHasFailed && sqlite3OsInMutex(1));
-}
-
-/*
** Set the "malloc has failed" condition to true for this thread.
*/
void sqlite3FailedMalloc(){
if( !sqlite3MallocFailed() ){
sqlite3OsEnterMutex();
- assert( mallocHasFailed==0 );
- mallocHasFailed = 1;
+ assert( sqlite3_mallocHasFailed==0 );
+ sqlite3_mallocHasFailed = 1;
}
}