mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Merge pull request #237 from sgrif/sg-remove-libc
Remove the dependency on `libc`
This commit is contained in:
commit
6bac06cc49
@ -30,7 +30,6 @@ limits = []
|
|||||||
time = "0.1.0"
|
time = "0.1.0"
|
||||||
bitflags = "0.7"
|
bitflags = "0.7"
|
||||||
lru-cache = "0.1.0"
|
lru-cache = "0.1.0"
|
||||||
libc = "0.2"
|
|
||||||
chrono = { version = "0.3", optional = true }
|
chrono = { version = "0.3", optional = true }
|
||||||
serde_json = { version = "0.9", optional = true }
|
serde_json = { version = "0.9", optional = true }
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
* Clarifies supported SQLite versions. Running with SQLite older than 3.6.8 now panics, and
|
* Clarifies supported SQLite versions. Running with SQLite older than 3.6.8 now panics, and
|
||||||
some features will not compile unless a sufficiently-recent SQLite version is used. See
|
some features will not compile unless a sufficiently-recent SQLite version is used. See
|
||||||
the README for requirements of particular features.
|
the README for requirements of particular features.
|
||||||
|
* Removes the `libc` dependency in favor of using `std::os::raw`
|
||||||
|
|
||||||
# Version 0.9.5 (2017-01-26)
|
# Version 0.9.5 (2017-01-26)
|
||||||
|
|
||||||
|
@ -15,6 +15,3 @@ bundled = []
|
|||||||
bindgen = "0.21"
|
bindgen = "0.21"
|
||||||
pkg-config = "0.3"
|
pkg-config = "0.3"
|
||||||
gcc = "0.3"
|
gcc = "0.3"
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
libc = "0.2"
|
|
||||||
|
@ -27,7 +27,6 @@ fn run_bindgen<T: Into<String>>(header: T) {
|
|||||||
let mut output = Vec::new();
|
let mut output = Vec::new();
|
||||||
bindgen::builder()
|
bindgen::builder()
|
||||||
.header(header.clone())
|
.header(header.clone())
|
||||||
.ctypes_prefix("::libc")
|
|
||||||
.type_chooser(Box::new(SqliteTypeChooser))
|
.type_chooser(Box::new(SqliteTypeChooser))
|
||||||
.generate()
|
.generate()
|
||||||
.expect(&format!("could not run bindgen on header {}", header))
|
.expect(&format!("could not run bindgen on header {}", header))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
use std::error;
|
use std::error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#![allow(non_snake_case, non_camel_case_types)]
|
#![allow(non_snake_case, non_camel_case_types)]
|
||||||
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
pub use self::error::*;
|
pub use self::error::*;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
@ -30,7 +30,7 @@ use std::marker::PhantomData;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use std::error;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str;
|
use std::str;
|
||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
use {ffi, errmsg_to_string};
|
use {ffi, errmsg_to_string};
|
||||||
use types::Type;
|
use types::Type;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ use std::ffi::CStr;
|
|||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use libc::{c_int, c_char, c_void};
|
use std::os::raw::{c_int, c_char, c_void};
|
||||||
|
|
||||||
use ffi;
|
use ffi;
|
||||||
use ffi::sqlite3_context;
|
use ffi::sqlite3_context;
|
||||||
@ -508,7 +508,7 @@ mod test {
|
|||||||
extern crate regex;
|
extern crate regex;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use libc::c_double;
|
use std::os::raw::c_double;
|
||||||
use self::regex::Regex;
|
use self::regex::Regex;
|
||||||
use std::f64::EPSILON;
|
use std::f64::EPSILON;
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
//! ```
|
//! ```
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
|
|
||||||
extern crate libc;
|
|
||||||
extern crate libsqlite3_sys as ffi;
|
extern crate libsqlite3_sys as ffi;
|
||||||
extern crate lru_cache;
|
extern crate lru_cache;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -74,7 +73,7 @@ use std::result;
|
|||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::{Once, ONCE_INIT};
|
use std::sync::{Once, ONCE_INIT};
|
||||||
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
|
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 types::{ToSql, ToSqlOutput, FromSql, FromSqlError, ValueRef};
|
||||||
use error::{error_from_sqlite_code, error_from_handle};
|
use error::{error_from_sqlite_code, error_from_handle};
|
||||||
@ -534,7 +533,7 @@ bitflags! {
|
|||||||
#[doc = "Flags for opening SQLite database connections."]
|
#[doc = "Flags for opening SQLite database connections."]
|
||||||
#[doc = "See [sqlite3_open_v2](http://www.sqlite.org/c3ref/open.html) for details."]
|
#[doc = "See [sqlite3_open_v2](http://www.sqlite.org/c3ref/open.html) for details."]
|
||||||
#[repr(C)]
|
#[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_ONLY = 0x00000001,
|
||||||
const SQLITE_OPEN_READ_WRITE = 0x00000002,
|
const SQLITE_OPEN_READ_WRITE = 0x00000002,
|
||||||
const SQLITE_OPEN_CREATE = 0x00000004,
|
const SQLITE_OPEN_CREATE = 0x00000004,
|
||||||
@ -742,7 +741,7 @@ impl InnerConnection {
|
|||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
let message = errmsg_to_string(&*errmsg);
|
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)))
|
Err(error_from_sqlite_code(r, Some(message)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1357,7 +1356,7 @@ mod test {
|
|||||||
let raw_stmt = {
|
let raw_stmt = {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
use super::str_to_cstring;
|
use super::str_to_cstring;
|
||||||
|
|
||||||
let raw_db = db.db.borrow_mut().db;
|
let raw_db = db.db.borrow_mut().db;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Run-Time Limits
|
//! Run-Time Limits
|
||||||
|
|
||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
|
|
||||||
use ffi;
|
use ffi;
|
||||||
pub use ffi::Limit;
|
pub use ffi::Limit;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::convert;
|
use std::convert;
|
||||||
use std::result;
|
use std::result;
|
||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
|
|
||||||
use {Result, Error, Connection, Statement, MappedRows, AndThenRows, Rows, Row, str_to_cstring};
|
use {Result, Error, Connection, Statement, MappedRows, AndThenRows, Rows, Row, str_to_cstring};
|
||||||
use types::ToSql;
|
use types::ToSql;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
use super::ffi;
|
use super::ffi;
|
||||||
|
|
||||||
// Private newtype for raw sqlite3_stmts that finalize themselves when dropped.
|
// Private newtype for raw sqlite3_stmts that finalize themselves when dropped.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Tracing and profiling functions. Error and warning log.
|
//! Tracing and profiling functions. Error and warning log.
|
||||||
|
|
||||||
use libc::{c_char, c_int, c_void};
|
use std::os::raw::{c_char, c_int, c_void};
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -73,11 +73,10 @@ mod serde_json;
|
|||||||
/// ## Example
|
/// ## Example
|
||||||
///
|
///
|
||||||
/// ```rust,no_run
|
/// ```rust,no_run
|
||||||
/// # extern crate libc;
|
|
||||||
/// # extern crate rusqlite;
|
/// # extern crate rusqlite;
|
||||||
/// # use rusqlite::{Connection, Result};
|
/// # use rusqlite::{Connection, Result};
|
||||||
/// # use rusqlite::types::{Null};
|
/// # use rusqlite::types::{Null};
|
||||||
/// # use libc::{c_int};
|
/// # use std::os::raw::{c_int};
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// }
|
/// }
|
||||||
/// fn insert_null(conn: &Connection) -> Result<c_int> {
|
/// fn insert_null(conn: &Connection) -> Result<c_int> {
|
||||||
@ -114,7 +113,7 @@ mod test {
|
|||||||
|
|
||||||
use Connection;
|
use Connection;
|
||||||
use Error;
|
use Error;
|
||||||
use libc::{c_int, c_double};
|
use std::os::raw::{c_int, c_double};
|
||||||
use std::f64::EPSILON;
|
use std::f64::EPSILON;
|
||||||
use super::Value;
|
use super::Value;
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate libc;
|
|
||||||
extern crate rusqlite;
|
extern crate rusqlite;
|
||||||
|
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
fn main() {
|
fn main() {
|
||||||
use libc::c_int;
|
use std::os::raw::c_int;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
Loading…
Reference in New Issue
Block a user