Introduce alloc to generate C string allocated by sqlite3

Safe to send to SQLite for deallocation.
This commit is contained in:
gwenn
2020-02-29 13:02:37 +01:00
parent a3e5ea990d
commit 5356a609de
2 changed files with 31 additions and 25 deletions

View File

@@ -372,25 +372,19 @@ rusqlite was built against SQLite {} but the runtime SQLite version is {}. To fi
});
}
#[cfg(not(any(
target_arch = "wasm32"
)))]
#[cfg(not(any(target_arch = "wasm32")))]
static SQLITE_INIT: std::sync::Once = std::sync::Once::new();
pub static BYPASS_SQLITE_INIT: AtomicBool = AtomicBool::new(false);
// threading mode checks are not necessary (and do not work) on target
// platforms that do not have threading (such as webassembly)
#[cfg(any(
target_arch = "wasm32"
))]
#[cfg(any(target_arch = "wasm32"))]
fn ensure_safe_sqlite_threading_mode() -> Result<()> {
Ok(())
}
#[cfg(not(any(
target_arch = "wasm32"
)))]
#[cfg(not(any(target_arch = "wasm32")))]
fn ensure_safe_sqlite_threading_mode() -> Result<()> {
// Ensure SQLite was compiled in thredsafe mode.
if unsafe { ffi::sqlite3_threadsafe() == 0 } {