Skip to content

Commit 2847350

Browse files
committed
add qsort_r for unix, and qsort and qsort_s for windows
1 parent ea7fc0f commit 2847350

File tree

8 files changed

+42
-0
lines changed

8 files changed

+42
-0
lines changed

libc-test/semver/apple.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,7 @@ ptrace
21212121
pututxline
21222122
pwritev
21232123
qsort
2124+
qsort_r
21242125
querylocale
21252126
quotactl
21262127
radvisory

libc-test/semver/freebsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,7 @@ ptsname_r
22412241
pututxline
22422242
pwritev
22432243
qsort
2244+
qsort_r
22442245
querylocale
22452246
rallocx
22462247
rand

libc-test/semver/netbsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,7 @@ ptrace_siginfo
15351535
pututxline
15361536
pwritev
15371537
qsort
1538+
qsort_r
15381539
rand
15391540
readdir_r
15401541
readlinkat

libc-test/semver/windows.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ putchar
275275
putenv
276276
putenv_s
277277
puts
278+
qsort
279+
qsort_s
278280
raise
279281
rand
280282
read

src/unix/bsd/apple/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5926,6 +5926,14 @@ extern "C" {
59265926
search_path: *const c_char,
59275927
argv: *const *mut c_char,
59285928
) -> c_int;
5929+
5930+
pub fn qsort_r(
5931+
base: *mut c_void,
5932+
num: size_t,
5933+
size: size_t,
5934+
arg: *mut c_void,
5935+
compar: Option<unsafe extern "C" fn(*mut c_void, *const c_void, *const c_void) -> c_int>,
5936+
);
59295937
}
59305938

59315939
cfg_if! {

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,14 @@ extern "C" {
18671867
fd: c_int,
18681868
newfd: c_int,
18691869
) -> c_int;
1870+
1871+
pub fn qsort_r(
1872+
base: *mut c_void,
1873+
num: size_t,
1874+
size: size_t,
1875+
compar: Option<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>,
1876+
arg: *mut c_void,
1877+
);
18701878
}
18711879

18721880
#[link(name = "rt")]

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,14 @@ extern "C" {
27552755
new_value: *const itimerspec,
27562756
old_value: *mut itimerspec,
27572757
) -> c_int;
2758+
2759+
pub fn qsort_r(
2760+
base: *mut c_void,
2761+
num: size_t,
2762+
size: size_t,
2763+
compar: Option<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>,
2764+
arg: *mut c_void,
2765+
);
27582766
}
27592767

27602768
#[link(name = "rt")]

src/windows/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,19 @@ extern "C" {
289289
pub fn isblank(c: c_int) -> c_int;
290290
pub fn tolower(c: c_int) -> c_int;
291291
pub fn toupper(c: c_int) -> c_int;
292+
pub fn qsort(
293+
base: *mut c_void,
294+
num: size_t,
295+
size: size_t,
296+
compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
297+
);
298+
pub fn qsort_s(
299+
base: *mut c_void,
300+
num: size_t,
301+
size: size_t,
302+
compar: Option<unsafe extern "C" fn(*mut c_void, *const c_void, *const c_void) -> c_int>,
303+
arg: *mut c_void,
304+
);
292305
pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
293306
pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
294307
pub fn fflush(file: *mut FILE) -> c_int;

0 commit comments

Comments
 (0)