Commit 47329cae authored by Jay Lee's avatar Jay Lee

use global extern crate

parent 3048f8fd
......@@ -7,3 +7,7 @@ Cargo.lock
_rust_rocksdb*
*rlib
tags
.idea/
out/
*.iml
\ No newline at end of file
......@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern crate libc;
use self::libc::{c_char, c_int, c_void, size_t};
use libc::{c_char, c_int, c_void, size_t};
use std::ffi::CString;
use std::mem;
use std::slice;
......
......@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern crate libc;
use self::libc::{c_char, c_int, c_void, size_t};
use libc::{self, c_char, c_int, c_void, size_t};
use std::ffi::CStr;
use std::str::from_utf8;
......@@ -92,7 +91,7 @@ pub fn error_message(ptr: *const i8) -> String {
let c_str = unsafe { CStr::from_ptr(ptr as *const _) };
let s = from_utf8(c_str.to_bytes()).unwrap().to_owned();
unsafe {
libc::free(ptr as *mut libc::c_void);
libc::free(ptr as *mut c_void);
}
s
}
......
......@@ -12,14 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
pub use ffi as rocksdb_ffi;
pub use ffi::{DBCompactionStyle, DBComparator, new_bloom_filter};
pub use rocksdb::{DB, DBIterator, DBVector, Direction, IteratorMode, Writable,
WriteBatch};
pub use rocksdb_options::{BlockBasedOptions, Options, WriteOptions};
pub use merge_operator::MergeOperands;
extern crate libc;
pub mod rocksdb;
pub mod ffi;
pub mod rocksdb_options;
pub mod merge_operator;
pub mod comparator;
pub use ffi::{DBCompactionStyle, DBComparator, new_bloom_filter,
self as rocksdb_ffi};
pub use rocksdb::{DB, DBIterator, DBVector, Direction, IteratorMode, Writable,
WriteBatch};
pub use rocksdb_options::{BlockBasedOptions, Options, WriteOptions};
pub use merge_operator::MergeOperands;
......@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern crate libc;
use self::libc::{c_char, c_int, c_void, size_t};
use libc::{self, c_char, c_int, c_void, size_t};
use std::ffi::CString;
use std::mem;
use std::ptr;
......
......@@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern crate libc;
use std::collections::BTreeMap;
use std::ffi::CString;
use std::fs;
......@@ -23,7 +20,7 @@ use std::path::Path;
use std::slice;
use std::str::from_utf8;
use self::libc::{c_void, size_t};
use libc::{self, c_int, c_void, size_t};
use rocksdb_ffi::{self, DBCFHandle, error_message};
use rocksdb_options::{Options, WriteOptions};
......@@ -313,7 +310,7 @@ impl DB {
let nfam = cfs_v.len();
unsafe {
db = rocksdb_ffi::rocksdb_open_column_families(opts.inner, cpath_ptr as *const _,
nfam as libc::c_int,
nfam as c_int,
cfnames.as_ptr() as *const _,
copts, handles, err_ptr);
}
......@@ -848,7 +845,7 @@ impl Deref for DBVector {
impl Drop for DBVector {
fn drop(&mut self) {
unsafe {
libc::free(self.base as *mut libc::c_void);
libc::free(self.base as *mut c_void);
}
}
}
......
......@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern crate libc;
use self::libc::{c_int, size_t};
use libc::{c_int, size_t};
use std::ffi::CString;
use std::mem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment