Omit the sqlite3Apis constant object when compiling with

SQLITE_OMIT_LOAD_EXTENSION, since it is not used.

FossilOrigin-Name: 7b10461370828b9c57acaaaea518031d53986fa3
This commit is contained in:
drh
2016-09-15 19:15:19 +00:00
parent 21e19b44f0
commit 98365be030
3 changed files with 14 additions and 20 deletions
+7 -13
View File
@@ -620,18 +620,7 @@ int sqlite3_enable_load_extension(sqlite3 *db, int onoff){
return SQLITE_OK;
}
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
/*
** The auto-extension code added regardless of whether or not extension
** loading is supported. We need a dummy sqlite3Apis pointer for that
** code if regular extension loading is not available. This is that
** dummy pointer.
*/
#ifdef SQLITE_OMIT_LOAD_EXTENSION
static const sqlite3_api_routines sqlite3Apis = { 0 };
#endif
#endif /* !defined(SQLITE_OMIT_LOAD_EXTENSION) */
/*
** The following object holds the list of automatically loaded
@@ -775,6 +764,11 @@ void sqlite3AutoLoadExtensions(sqlite3 *db){
char *zErrmsg;
#if SQLITE_THREADSAFE
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
#endif
#ifdef SQLITE_OMIT_LOAD_EXTENSION
const sqlite3_api_routines *pThunk = 0;
#else
const sqlite3_api_routines *pThunk = &sqlite3Apis;
#endif
sqlite3_mutex_enter(mutex);
if( i>=wsdAutoext.nExt ){
@@ -785,7 +779,7 @@ void sqlite3AutoLoadExtensions(sqlite3 *db){
}
sqlite3_mutex_leave(mutex);
zErrmsg = 0;
if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){
if( xInit && (rc = xInit(db, &zErrmsg, pThunk))!=0 ){
sqlite3ErrorWithMsg(db, rc,
"automatic extension loading failed: %s", zErrmsg);
go = 0;