summaryrefslogtreecommitdiffstats
path: root/lib/libsqlite3/src/loadext.c
diff options
context:
space:
mode:
authorjturner <jturner@openbsd.org>2013-09-21 17:34:00 +0000
committerjturner <jturner@openbsd.org>2013-09-21 17:34:00 +0000
commitfc5be0f32a9749b504f189091b6126cf8417bcab (patch)
tree68602384a19e477f8c42a3c00958ea5ef981f7ea /lib/libsqlite3/src/loadext.c
parentUpdate sqlite to 3.8.0.2. A list of changes are available here: (diff)
downloadwireguard-openbsd-fc5be0f32a9749b504f189091b6126cf8417bcab.tar.xz
wireguard-openbsd-fc5be0f32a9749b504f189091b6126cf8417bcab.zip
Merge conflicts
Diffstat (limited to 'lib/libsqlite3/src/loadext.c')
-rw-r--r--lib/libsqlite3/src/loadext.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/libsqlite3/src/loadext.c b/lib/libsqlite3/src/loadext.c
index 5ad68462634..496c2ca81cb 100644
--- a/lib/libsqlite3/src/loadext.c
+++ b/lib/libsqlite3/src/loadext.c
@@ -669,6 +669,35 @@ int sqlite3_auto_extension(void (*xInit)(void)){
}
/*
+** Cancel a prior call to sqlite3_auto_extension. Remove xInit from the
+** set of routines that is invoked for each new database connection, if it
+** is currently on the list. If xInit is not on the list, then this
+** routine is a no-op.
+**
+** Return 1 if xInit was found on the list and removed. Return 0 if xInit
+** was not on the list.
+*/
+int sqlite3_cancel_auto_extension(void (*xInit)(void)){
+#if SQLITE_THREADSAFE
+ sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
+#endif
+ int i;
+ int n = 0;
+ wsdAutoextInit;
+ sqlite3_mutex_enter(mutex);
+ for(i=wsdAutoext.nExt-1; i>=0; i--){
+ if( wsdAutoext.aExt[i]==xInit ){
+ wsdAutoext.nExt--;
+ wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt];
+ n++;
+ break;
+ }
+ }
+ sqlite3_mutex_leave(mutex);
+ return n;
+}
+
+/*
** Reset the automatic extension loading mechanism.
*/
void sqlite3_reset_auto_extension(void){