Remove the dependency on libc

Recent versions of bindgen use `std::os::raw` over `libc`, but currently
`libsqlite3-sys` is overriding that. `std::os::raw` is a subset of
`libc` that exports only the relevant type definitions, but not any
functions which require additional linking. This enables
`libsqlite3-sys` to be more easily used on targets that may not have a
libc available (presumably sqlite itself would have been compiled with
musl in that case)
This commit is contained in:
Sean Griffin
2017-02-16 11:17:24 -05:00
parent 7a8dfbd555
commit 2c58b3f804
16 changed files with 17 additions and 26 deletions

View File

@@ -52,7 +52,6 @@
//! ```
#![allow(unknown_lints)]
extern crate libc;
extern crate libsqlite3_sys as ffi;
extern crate lru_cache;
#[macro_use]
@@ -74,7 +73,7 @@ use std::result;
use std::str;
use std::sync::{Once, ONCE_INIT};
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
use libc::{c_int, c_char, c_void};
use std::os::raw::{c_int, c_char, c_void};
use types::{ToSql, ToSqlOutput, FromSql, FromSqlError, ValueRef};
use error::{error_from_sqlite_code, error_from_handle};
@@ -534,7 +533,7 @@ bitflags! {
#[doc = "Flags for opening SQLite database connections."]
#[doc = "See [sqlite3_open_v2](http://www.sqlite.org/c3ref/open.html) for details."]
#[repr(C)]
pub flags OpenFlags: ::libc::c_int {
pub flags OpenFlags: ::std::os::raw::c_int {
const SQLITE_OPEN_READ_ONLY = 0x00000001,
const SQLITE_OPEN_READ_WRITE = 0x00000002,
const SQLITE_OPEN_CREATE = 0x00000004,
@@ -742,7 +741,7 @@ impl InnerConnection {
Ok(())
} else {
let message = errmsg_to_string(&*errmsg);
ffi::sqlite3_free(errmsg as *mut libc::c_void);
ffi::sqlite3_free(errmsg as *mut ::std::os::raw::c_void);
Err(error_from_sqlite_code(r, Some(message)))
}
}
@@ -1357,7 +1356,7 @@ mod test {
let raw_stmt = {
use std::mem;
use std::ptr;
use libc::c_int;
use std::os::raw::c_int;
use super::str_to_cstring;
let raw_db = db.db.borrow_mut().db;