1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

If the SQLITE_EXTRA_INIT function is defined, make sure it is called only

once by the effective sqlite3_initialize() call.

FossilOrigin-Name: e2b597cafe7c8a8313b051d6a302fed54f235727
This commit is contained in:
drh
2013-08-08 14:38:45 +00:00
parent 869c0409e3
commit ab80be99e3
3 changed files with 14 additions and 8 deletions

View File

@@ -117,6 +117,9 @@ char *sqlite3_data_directory = 0;
int sqlite3_initialize(void){
MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */
int rc; /* Result code */
#ifdef SQLITE_EXTRA_INIT
int bRunExtraInit = 0; /* Extra initialization needed */
#endif
#ifdef SQLITE_OMIT_WSD
rc = sqlite3_wsd_init(4096, 24);
@@ -214,6 +217,9 @@ int sqlite3_initialize(void){
sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage,
sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage);
sqlite3GlobalConfig.isInit = 1;
#ifdef SQLITE_EXTRA_INIT
bRunExtraInit = 1;
#endif
}
sqlite3GlobalConfig.inProgress = 0;
}
@@ -254,7 +260,7 @@ int sqlite3_initialize(void){
** compile-time option.
*/
#ifdef SQLITE_EXTRA_INIT
if( rc==SQLITE_OK && sqlite3GlobalConfig.isInit ){
if( bRunExtraInit ){
int SQLITE_EXTRA_INIT(const char*);
rc = SQLITE_EXTRA_INIT(0);
}