]> git.lizzy.rs Git - rust.git/commitdiff
native: Convert statics to constants
authorAlex Crichton <alex@alexcrichton.com>
Mon, 6 Oct 2014 23:33:29 +0000 (16:33 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 9 Oct 2014 16:44:51 +0000 (09:44 -0700)
src/libnative/io/c_unix.rs
src/libnative/io/c_windows.rs

index a8ebcda3cdd1a7bc15db74deff0a6b780a4ef7f6..c2af9c03c42c1c59d813cbf5ef5c7595e6bf8e04 100644 (file)
           target_os = "ios",
           target_os = "freebsd",
           target_os = "dragonfly"))]
-pub static FIONBIO: libc::c_ulong = 0x8004667e;
+pub const FIONBIO: libc::c_ulong = 0x8004667e;
 #[cfg(any(all(target_os = "linux",
               any(target_arch = "x86",
                   target_arch = "x86_64",
                   target_arch = "arm")),
           target_os = "android"))]
-pub static FIONBIO: libc::c_ulong = 0x5421;
+pub const FIONBIO: libc::c_ulong = 0x5421;
 #[cfg(all(target_os = "linux",
           any(target_arch = "mips", target_arch = "mipsel")))]
-pub static FIONBIO: libc::c_ulong = 0x667e;
+pub const FIONBIO: libc::c_ulong = 0x667e;
 
 #[cfg(any(target_os = "macos",
           target_os = "ios",
           target_os = "freebsd",
           target_os = "dragonfly"))]
-pub static FIOCLEX: libc::c_ulong = 0x20006601;
+pub const FIOCLEX: libc::c_ulong = 0x20006601;
 #[cfg(any(all(target_os = "linux",
               any(target_arch = "x86",
                   target_arch = "x86_64",
                   target_arch = "arm")),
           target_os = "android"))]
-pub static FIOCLEX: libc::c_ulong = 0x5451;
+pub const FIOCLEX: libc::c_ulong = 0x5451;
 #[cfg(all(target_os = "linux",
           any(target_arch = "mips", target_arch = "mipsel")))]
-pub static FIOCLEX: libc::c_ulong = 0x6601;
+pub const FIOCLEX: libc::c_ulong = 0x6601;
 
 #[cfg(any(target_os = "macos",
           target_os = "ios",
           target_os = "freebsd",
           target_os = "dragonfly"))]
-pub static MSG_DONTWAIT: libc::c_int = 0x80;
+pub const MSG_DONTWAIT: libc::c_int = 0x80;
 #[cfg(any(target_os = "linux", target_os = "android"))]
-pub static MSG_DONTWAIT: libc::c_int = 0x40;
+pub const MSG_DONTWAIT: libc::c_int = 0x40;
 
-pub static WNOHANG: libc::c_int = 1;
+pub const WNOHANG: libc::c_int = 1;
 
 extern {
     pub fn gettimeofday(timeval: *mut libc::timeval,
@@ -89,7 +89,7 @@ pub fn sigaction(signum: libc::c_int,
 
 #[cfg(any(target_os = "macos", target_os = "ios"))]
 mod select {
-    pub static FD_SETSIZE: uint = 1024;
+    pub const FD_SETSIZE: uint = 1024;
 
     #[repr(C)]
     pub struct fd_set {
@@ -109,7 +109,7 @@ mod select {
     use std::uint;
     use libc;
 
-    pub static FD_SETSIZE: uint = 1024;
+    pub const FD_SETSIZE: uint = 1024;
 
     #[repr(C)]
     pub struct fd_set {
@@ -131,14 +131,14 @@ pub fn fd_set(set: &mut fd_set, fd: i32) {
 mod signal {
     use libc;
 
-    pub static SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
-    pub static SA_NOCLDWAIT: libc::c_ulong = 0x00000002;
-    pub static SA_NODEFER: libc::c_ulong = 0x40000000;
-    pub static SA_ONSTACK: libc::c_ulong = 0x08000000;
-    pub static SA_RESETHAND: libc::c_ulong = 0x80000000;
-    pub static SA_RESTART: libc::c_ulong = 0x10000000;
-    pub static SA_SIGINFO: libc::c_ulong = 0x00000004;
-    pub static SIGCHLD: libc::c_int = 17;
+    pub const SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
+    pub const SA_NOCLDWAIT: libc::c_ulong = 0x00000002;
+    pub const SA_NODEFER: libc::c_ulong = 0x40000000;
+    pub const SA_ONSTACK: libc::c_ulong = 0x08000000;
+    pub const SA_RESETHAND: libc::c_ulong = 0x80000000;
+    pub const SA_RESTART: libc::c_ulong = 0x10000000;
+    pub const SA_SIGINFO: libc::c_ulong = 0x00000004;
+    pub const SIGCHLD: libc::c_int = 17;
 
     // This definition is not as accurate as it could be, {pid, uid, status} is
     // actually a giant union. Currently we're only interested in these fields,
@@ -179,14 +179,14 @@ pub struct sigset_t {
 mod signal {
     use libc;
 
-    pub static SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
-    pub static SA_NOCLDWAIT: libc::c_ulong = 0x00010000;
-    pub static SA_NODEFER: libc::c_ulong = 0x40000000;
-    pub static SA_ONSTACK: libc::c_ulong = 0x08000000;
-    pub static SA_RESETHAND: libc::c_ulong = 0x80000000;
-    pub static SA_RESTART: libc::c_ulong = 0x10000000;
-    pub static SA_SIGINFO: libc::c_ulong = 0x00000008;
-    pub static SIGCHLD: libc::c_int = 18;
+    pub const SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
+    pub const SA_NOCLDWAIT: libc::c_ulong = 0x00010000;
+    pub const SA_NODEFER: libc::c_ulong = 0x40000000;
+    pub const SA_ONSTACK: libc::c_ulong = 0x08000000;
+    pub const SA_RESETHAND: libc::c_ulong = 0x80000000;
+    pub const SA_RESTART: libc::c_ulong = 0x10000000;
+    pub const SA_SIGINFO: libc::c_ulong = 0x00000008;
+    pub const SIGCHLD: libc::c_int = 18;
 
     // This definition is not as accurate as it could be, {pid, uid, status} is
     // actually a giant union. Currently we're only interested in these fields,
@@ -223,14 +223,14 @@ pub struct sigset_t {
 mod signal {
     use libc;
 
-    pub static SA_ONSTACK: libc::c_int = 0x0001;
-    pub static SA_RESTART: libc::c_int = 0x0002;
-    pub static SA_RESETHAND: libc::c_int = 0x0004;
-    pub static SA_NOCLDSTOP: libc::c_int = 0x0008;
-    pub static SA_NODEFER: libc::c_int = 0x0010;
-    pub static SA_NOCLDWAIT: libc::c_int = 0x0020;
-    pub static SA_SIGINFO: libc::c_int = 0x0040;
-    pub static SIGCHLD: libc::c_int = 20;
+    pub const SA_ONSTACK: libc::c_int = 0x0001;
+    pub const SA_RESTART: libc::c_int = 0x0002;
+    pub const SA_RESETHAND: libc::c_int = 0x0004;
+    pub const SA_NOCLDSTOP: libc::c_int = 0x0008;
+    pub const SA_NODEFER: libc::c_int = 0x0010;
+    pub const SA_NOCLDWAIT: libc::c_int = 0x0020;
+    pub const SA_SIGINFO: libc::c_int = 0x0040;
+    pub const SIGCHLD: libc::c_int = 20;
 
     #[cfg(any(target_os = "macos", target_os = "ios"))]
     pub type sigset_t = u32;
index 909b37895b7b5495036f46c027fa8ca0d8a7ccc8..2266f41eff9af5d75b06308b23319b4d9110d9ba 100644 (file)
 
 use libc;
 
-pub static WSADESCRIPTION_LEN: uint = 256;
-pub static WSASYS_STATUS_LEN: uint = 128;
-pub static FIONBIO: libc::c_long = 0x8004667e;
+pub const WSADESCRIPTION_LEN: uint = 256;
+pub const WSASYS_STATUS_LEN: uint = 128;
+pub const FIONBIO: libc::c_long = 0x8004667e;
 static FD_SETSIZE: uint = 64;
-pub static MSG_DONTWAIT: libc::c_int = 0;
-pub static ERROR_ILLEGAL_CHARACTER: libc::c_int = 582;
-pub static ENABLE_ECHO_INPUT: libc::DWORD = 0x4;
-pub static ENABLE_EXTENDED_FLAGS: libc::DWORD = 0x80;
-pub static ENABLE_INSERT_MODE: libc::DWORD = 0x20;
-pub static ENABLE_LINE_INPUT: libc::DWORD = 0x2;
-pub static ENABLE_PROCESSED_INPUT: libc::DWORD = 0x1;
-pub static ENABLE_QUICK_EDIT_MODE: libc::DWORD = 0x40;
-pub static WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT;
-
-pub static FD_ACCEPT: libc::c_long = 0x08;
-pub static FD_MAX_EVENTS: uint = 10;
-pub static WSA_INFINITE: libc::DWORD = libc::INFINITE;
-pub static WSA_WAIT_TIMEOUT: libc::DWORD = libc::consts::os::extra::WAIT_TIMEOUT;
-pub static WSA_WAIT_EVENT_0: libc::DWORD = libc::consts::os::extra::WAIT_OBJECT_0;
-pub static WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED;
+pub const MSG_DONTWAIT: libc::c_int = 0;
+pub const ERROR_ILLEGAL_CHARACTER: libc::c_int = 582;
+pub const ENABLE_ECHO_INPUT: libc::DWORD = 0x4;
+pub const ENABLE_EXTENDED_FLAGS: libc::DWORD = 0x80;
+pub const ENABLE_INSERT_MODE: libc::DWORD = 0x20;
+pub const ENABLE_LINE_INPUT: libc::DWORD = 0x2;
+pub const ENABLE_PROCESSED_INPUT: libc::DWORD = 0x1;
+pub const ENABLE_QUICK_EDIT_MODE: libc::DWORD = 0x40;
+pub const WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT;
+
+pub const FD_ACCEPT: libc::c_long = 0x08;
+pub const FD_MAX_EVENTS: uint = 10;
+pub const WSA_INFINITE: libc::DWORD = libc::INFINITE;
+pub const WSA_WAIT_TIMEOUT: libc::DWORD = libc::consts::os::extra::WAIT_TIMEOUT;
+pub const WSA_WAIT_EVENT_0: libc::DWORD = libc::consts::os::extra::WAIT_OBJECT_0;
+pub const WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED;
 
 #[repr(C)]
 #[cfg(target_arch = "x86")]