Reduce usage of libc crate.

Switch from using `libc` types to `::std::os::raw`. This is a breaking
change due to the differences in how `c_void` is defined.

`core-foundation-sys` no longer needs the `libc` dependency.
This commit is contained in:
Bruce Mitchener
2018-02-01 09:26:19 +07:00
parent db9c247243
commit 7e7d65bb4d
24 changed files with 26 additions and 27 deletions
-1
View File
@@ -9,7 +9,6 @@ license = "MIT / Apache-2.0"
build = "build.rs"
[dependencies]
libc = "0.2"
[features]
mac_os_10_7_support = [] # backwards compatibility
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFRange, CFIndex, CFAllocatorRef, CFTypeID, Boolean};
use string::CFStringRef;
+1 -1
View File
@@ -8,7 +8,7 @@
// except according to those terms.
use std::cmp::Ordering;
use libc::{c_uint, c_long, c_ulong, c_void, c_int};
use std::os::raw::{c_uint, c_long, c_ulong, c_void, c_int};
use string::CFStringRef;
pub type Boolean = u8;
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFTypeID, CFAllocatorRef};
use url::CFURLRef;
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFTypeID, CFIndex};
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFComparisonResult, CFTypeID};
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::{c_void};
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFHashCode, CFIndex, CFTypeID, Boolean};
use string::CFStringRef;
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFTypeID, CFIndex};
use string::CFStringRef;
+2 -1
View File
@@ -7,7 +7,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::{c_void, c_int};
use std::os::raw::{c_int, c_void};
use base::{Boolean, CFIndex, CFTypeID, CFOptionFlags, CFAllocatorRef};
use string::CFStringRef;
use runloop::CFRunLoopSourceRef;
-2
View File
@@ -10,8 +10,6 @@
#![cfg_attr(all(feature="mac_os_10_7_support", feature="mac_os_10_8_features"), feature(linkage))] // back-compat requires weak linkage
extern crate libc;
pub mod array;
pub mod base;
pub mod bundle;
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFIndex, CFTypeID, Boolean};
use data::CFDataRef;
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFTypeID, CFComparisonResult};
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use array::CFArrayRef;
use base::{Boolean, CFIndex, CFTypeID, CFAllocatorRef, CFOptionFlags, CFHashCode, mach_port_t};
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFIndex, CFTypeID};
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::{c_char, c_ushort, c_void};
use std::os::raw::{c_char, c_ushort, c_void};
use base::{Boolean, CFOptionFlags, CFIndex, CFAllocatorRef, CFRange, CFTypeID};
+1 -1
View File
@@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFTypeID};
use date::{CFTimeInterval, CFAbsoluteTime};
+2 -1
View File
@@ -6,7 +6,8 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFOptionFlags, CFIndex, CFAllocatorRef, Boolean, CFTypeID, CFTypeRef, SInt32};
use string::{CFStringRef, CFStringEncoding};
+2 -1
View File
@@ -6,7 +6,8 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::c_void;
use std::os::raw::c_void;
use base::{CFAllocatorRef, CFTypeID};
+1 -1
View File
@@ -12,12 +12,12 @@
pub use core_foundation_sys::array::*;
pub use core_foundation_sys::base::CFIndex;
use core_foundation_sys::base::{CFTypeRef, CFRelease, kCFAllocatorDefault};
use libc::c_void;
use std::mem;
use std::mem::ManuallyDrop;
use std::marker::PhantomData;
use std;
use std::ops::Deref;
use std::os::raw::c_void;
use std::fmt::{Debug, Formatter};
use base::{CFIndexConvertible, TCFType, TCFTypeRef, CFRange};
+1 -1
View File
@@ -12,8 +12,8 @@
pub use core_foundation_sys::dictionary::*;
use core_foundation_sys::base::{CFTypeRef, kCFAllocatorDefault};
use libc::c_void;
use std::mem;
use std::os::raw::c_void;
use std::ptr;
use base::{CFType, CFIndexConvertible, TCFType, TCFTypeRef};
+2 -1
View File
@@ -107,9 +107,10 @@ mod test {
use super::*;
use std::ffi::CString;
use libc::{c_void, O_RDWR};
use std::os::raw::c_void;
use core_foundation_sys::base::{CFOptionFlags};
use core_foundation_sys::runloop::{kCFRunLoopDefaultMode};
use libc::O_RDWR;
use runloop::{CFRunLoop};
#[test]
+1 -2
View File
@@ -11,8 +11,7 @@
use std::ptr;
use std::mem;
use libc::c_void;
use std::os::raw::c_void;
use error::CFError;
use data::CFData;
+1 -1
View File
@@ -152,7 +152,7 @@ mod test {
use super::*;
use date::{CFDate, CFAbsoluteTime};
use std::mem;
use libc::c_void;
use std::os::raw::c_void;
use std::sync::mpsc;
#[test]
@@ -1,9 +1,8 @@
#[macro_use]
extern crate core_foundation;
extern crate libc;
use core_foundation::base::{CFComparisonResult, TCFType};
use libc::c_void;
use std::os::raw::c_void;
// sys equivalent stuff that must be declared