summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-06-03 21:28:53 +0000
committerbors <bors@rust-lang.org>2021-06-03 21:28:53 +0000
commit9bf70c40799bda360f4ae0689a8fa4421e5a8d67 (patch)
tree3cd1005ea2c4562a8bf88619e4a3b5ef68154fe8
parent1d5190618101005058d8d0e3eb8fd1e990be6882 (diff)
parentff0ca7d1b1f784beee614f4f4a82be7ddf353b35 (diff)
downloadrust-libc-9bf70c40799bda360f4ae0689a8fa4421e5a8d67.tar.gz
Auto merge of #2208 - JohnTitor:memmem-macos, r=Amanieu
Declare `memmem` on macOS Closes #2181
-rw-r--r--libc-test/semver/macos.txt1
-rw-r--r--src/unix/bsd/apple/mod.rs13
2 files changed, 14 insertions, 0 deletions
diff --git a/libc-test/semver/macos.txt b/libc-test/semver/macos.txt
new file mode 100644
index 0000000000..d6a91320b8
--- /dev/null
+++ b/libc-test/semver/macos.txt
@@ -0,0 +1 @@
+memmem
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 8449e9a1f0..bbab89ed61 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -4100,6 +4100,19 @@ extern "C" {
pub fn proc_libversion(major: *mut ::c_int, mintor: *mut ::c_int) -> ::c_int;
}
+cfg_if! {
+ if #[cfg(target_os = "macos")] {
+ extern "C" {
+ pub fn memmem(
+ haystack: *const ::c_void,
+ haystacklen: ::size_t,
+ needle: *const ::c_void,
+ needlelen: ::size_t,
+ ) -> *mut ::c_void;
+ }
+ }
+}
+
#[link(name = "iconv")]
extern "C" {
pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;