Skip to content

Commit 0c996a0

Browse files
committed
adding reallocarray for linux and android
1 parent dc576de commit 0c996a0

File tree

7 files changed

+12
-0
lines changed

7 files changed

+12
-0
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,7 @@ fn test_android(target: &str) {
16291629
// We skip the test here since here _GNU_SOURCE is defined, and
16301630
// test the XSI version below.
16311631
"strerror_r" => true,
1632+
"reallocarray" => true,
16321633

16331634
_ => false,
16341635
}
@@ -2873,6 +2874,8 @@ fn test_linux(target: &str) {
28732874
// Needs glibc 2.33 or later.
28742875
"mallinfo2" => true,
28752876

2877+
"reallocarray" if musl => true,
2878+
28762879
_ => false,
28772880
}
28782881
});

libc-test/semver/android.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,6 +3044,7 @@ readlink
30443044
readlinkat
30453045
readv
30463046
realloc
3047+
reallocarray
30473048
realpath
30483049
recv
30493050
recvfrom

libc-test/semver/linux-gnu.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ pthread_setname_np
566566
pututxline
567567
pwritev2
568568
qsort_r
569+
reallocarray
569570
semid_ds
570571
seminfo
571572
setutxent

libc-test/semver/linux-musl.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# TODO: musl.
22
explicit_bzero
3+
reallocarray

src/unix/linux_like/android/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,6 +2879,8 @@ extern "C" {
28792879
pub fn arc4random() -> u32;
28802880
pub fn arc4random_uniform(__upper_bound: u32) -> u32;
28812881
pub fn arc4random_buf(__buf: *mut ::c_void, __n: ::size_t);
2882+
2883+
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
28822884
}
28832885

28842886
cfg_if! {

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,8 @@ extern "C" {
12761276

12771277
// Added in `glibc` 2.25
12781278
pub fn explicit_bzero(s: *mut ::c_void, len: ::size_t);
1279+
// Added in `glibc` 2.29
1280+
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
12791281
}
12801282

12811283
extern "C" {

src/unix/linux_like/linux/musl/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ extern "C" {
700700

701701
// Added in `musl` 1.1.20
702702
pub fn explicit_bzero(s: *mut ::c_void, len: ::size_t);
703+
// Added in `musl` 1.2.2
704+
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
703705
}
704706

705707
cfg_if! {

0 commit comments

Comments
 (0)