]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Faster implementation of the sqlite3ApiExit() routine.
authordrh <drh@noemail.net>
Sat, 23 Aug 2014 20:25:53 +0000 (20:25 +0000)
committerdrh <drh@noemail.net>
Sat, 23 Aug 2014 20:25:53 +0000 (20:25 +0000)
FossilOrigin-Name: bd41d394d48516eb7d8ddc46abdcb427aa80173e

manifest
manifest.uuid
src/malloc.c

index 0f001ae399aa1a0bba36112983a68a55d8f07edf..1044726bb029b2fb8deff1de4bdcb0f469213a54 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Another\smemory\sallocator\sperformance\soptimization.
-D 2014-08-23T19:42:06.737
+C Faster\simplementation\sof\sthe\ssqlite3ApiExit()\sroutine.
+D 2014-08-23T20:25:53.209
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -191,7 +191,7 @@ F src/legacy.c 87c92f4a08e2f70220e3b22a9c3b2482d36a134a
 F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
 F src/loadext.c 31c2122b7dd05a179049bbf163fd4839f181cbab
 F src/main.c 900dd06e41d22795cbb23ab0240397f1e2901bf7
-F src/malloc.c 06f8507831d04d2830237bf0c9f2fd04623f9868
+F src/malloc.c 954de5f998c23237e04474a3f2159bf483bba65a
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b
 F src/mem2.c dce31758da87ec2cfa52ba4c5df1aed6e07d8e8f
@@ -1188,7 +1188,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 45abd5c0bad2847861f3b26a7040490aa9bb1332
-R 863f9a5c456ee79d86d610ec7db424be
+P 6da6f46d0c43e3b68c21f514ddf8ee663c20f249
+R cfcb5b6ff857caed22b759c12472ea06
 U drh
-Z 2076d0986bc3817907a655695f4a8b4e
+Z c1d7ee14996f329ac13456e7bf7bb3df
index 7e569bfcb7dbe829e2842eabf5c65c4a521e371d..215297c16bcb78bdf1deba3354bf7a6d27c400fb 100644 (file)
@@ -1 +1 @@
-6da6f46d0c43e3b68c21f514ddf8ee663c20f249
\ No newline at end of file
+bd41d394d48516eb7d8ddc46abdcb427aa80173e
\ No newline at end of file
index 1b219604bc2fed56cb8be1dae634965bbcf626cb..b4b70350f4f4d2964a164a8d64c836d278991ae1 100644 (file)
@@ -761,6 +761,14 @@ void sqlite3SetString(char **pz, sqlite3 *db, const char *zFormat, ...){
   *pz = z;
 }
 
+/*
+** Take actions at the end of an API call to indicate an OOM error
+*/
+static SQLITE_NOINLINE int apiOomError(sqlite3 *db){
+  db->mallocFailed = 0;
+  sqlite3Error(db, SQLITE_NOMEM);
+  return SQLITE_NOMEM;
+}
 
 /*
 ** This function must be called before exiting any API function (i.e. 
@@ -781,10 +789,9 @@ int sqlite3ApiExit(sqlite3* db, int rc){
   ** is unsafe, as is the call to sqlite3Error().
   */
   assert( !db || sqlite3_mutex_held(db->mutex) );
-  if( db && (db->mallocFailed || rc==SQLITE_IOERR_NOMEM) ){
-    sqlite3Error(db, SQLITE_NOMEM);
-    db->mallocFailed = 0;
-    rc = SQLITE_NOMEM;
+  if( db==0 ) return rc & 0xff;
+  if( db->mallocFailed || rc==SQLITE_IOERR_NOMEM ){
+    return apiOomError(db);
   }
-  return rc & (db ? db->errMask : 0xff);
+  return rc & db->errMask;
 }