summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Parker-Shemilt <palfrey@tevp.net>2018-11-23 22:33:20 +0000
committerTom Parker-Shemilt <palfrey@tevp.net>2018-11-23 22:33:20 +0000
commitcd6b95db83dd46fad581730c021bf5666a0d9e7b (patch)
treebffdaf076ad2ba262f9028d1d096efc1b31f97cc
parentd75fc9c34acbde46f2665fcc740896b900138094 (diff)
downloadrust-libc-cd6b95db83dd46fad581730c021bf5666a0d9e7b.tar.gz
Split out windows strcase* work into gnu/msvc files
-rw-r--r--src/windows/gnu.rs8
-rw-r--r--src/windows/mod.rs (renamed from src/windows.rs)42
-rw-r--r--src/windows/msvc.rs10
3 files changed, 30 insertions, 30 deletions
diff --git a/src/windows/gnu.rs b/src/windows/gnu.rs
new file mode 100644
index 0000000000..a67af15a8f
--- /dev/null
+++ b/src/windows/gnu.rs
@@ -0,0 +1,8 @@
+pub const L_tmpnam: ::c_uint = 14;
+pub const TMP_MAX: ::c_uint = 0x7fff;
+
+extern {
+ pub fn strcasecmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
+ pub fn strncasecmp(s1: *const ::c_char, s2: *const ::c_char,
+ n: ::size_t) -> ::c_int;
+}
diff --git a/src/windows.rs b/src/windows/mod.rs
index 1d2d96b4ff..79ef49109b 100644
--- a/src/windows.rs
+++ b/src/windows/mod.rs
@@ -111,18 +111,6 @@ pub const BUFSIZ: ::c_uint = 512;
pub const FOPEN_MAX: ::c_uint = 20;
pub const FILENAME_MAX: ::c_uint = 260;
-cfg_if! {
- if #[cfg(all(target_env = "gnu"))] {
- pub const L_tmpnam: ::c_uint = 14;
- pub const TMP_MAX: ::c_uint = 0x7fff;
- } else if #[cfg(all(target_env = "msvc"))] {
- pub const L_tmpnam: ::c_uint = 260;
- pub const TMP_MAX: ::c_uint = 0x7fff_ffff;
- } else {
- // Unknown target_env
- }
-}
-
pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1;
pub const O_RDWR: ::c_int = 2;
@@ -382,24 +370,6 @@ extern {
}
cfg_if! {
- extern {
- if #[cfg(all(target_env = "gnu"))] {
- pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
- pub fn strncasecmp(s1: *const c_char, s2: *const c_char,
- n: size_t) -> c_int;
- } else if #[cfg(all(target_env = "msvc"))] {
- #[link_name = "_stricmp"]
- pub fn stricmp(s1: *const c_char, s2: *const c_char) -> c_int;
- #[link_name = "_strnicmp"]
- pub fn strnicmp(s1: *const c_char, s2: *const c_char,
- n: size_t) -> c_int;
- } else {
- // Unknown target_env
- }
- }
-}
-
-cfg_if! {
if #[cfg(core_cvoid)] {
pub use core::ffi::c_void;
} else {
@@ -416,3 +386,15 @@ cfg_if! {
}
}
}
+
+cfg_if! {
+ if #[cfg(all(target_env = "gnu"))] {
+ mod gnu;
+ pub use self::gnu::*;
+ } else if #[cfg(all(target_env = "msvc"))] {
+ mod msvc;
+ pub use self::msvc::*;
+ } else {
+ // Unknown target_env
+ }
+} \ No newline at end of file
diff --git a/src/windows/msvc.rs b/src/windows/msvc.rs
new file mode 100644
index 0000000000..9e2a9b9e5d
--- /dev/null
+++ b/src/windows/msvc.rs
@@ -0,0 +1,10 @@
+pub const L_tmpnam: ::c_uint = 260;
+pub const TMP_MAX: ::c_uint = 0x7fff_ffff;
+
+extern {
+ #[link_name = "_stricmp"]
+ pub fn stricmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
+ #[link_name = "_strnicmp"]
+ pub fn strnicmp(s1: *const ::c_char, s2: *const ::c_char,
+ n: ::size_t) -> ::c_int;
+} \ No newline at end of file