Skip to content

Commit

Permalink
Add qsort, qsort_r and bsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
malbarbo committed Feb 19, 2020
1 parent 8a7b02c commit 1914ae8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/unix/linux_like/linux/gnu/mod.rs
Expand Up @@ -894,6 +894,19 @@ cfg_if! {
pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3;

extern "C" {
pub fn qsort_r(
base: *mut ::c_void,
num: ::size_t,
size: ::size_t,
compar: ::Option<
unsafe extern "C" fn(
*const ::c_void,
*const ::c_void,
*mut ::c_void,
) -> ::c_int,
>,
arg: *mut ::c_void,
);
pub fn sendmmsg(
sockfd: ::c_int,
msgvec: *mut ::mmsghdr,
Expand Down
17 changes: 17 additions & 0 deletions src/unix/mod.rs
Expand Up @@ -388,6 +388,23 @@ extern "C" {
pub fn isblank(c: c_int) -> c_int;
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
pub fn qsort(
base: *mut c_void,
num: size_t,
size: size_t,
compar: ::Option<
unsafe extern "C" fn(*const c_void, *const c_void) -> c_int,
>,
);
pub fn bsearch(
key: *const c_void,
base: *const c_void,
num: size_t,
size: size_t,
compar: ::Option<
unsafe extern "C" fn(*const c_void, *const c_void) -> c_int,
>,
) -> *mut c_void;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "fopen$UNIX2003"
Expand Down

0 comments on commit 1914ae8

Please sign in to comment.