Skip to content

Commit 3966e4f

Browse files
committed
Use a macro instead of a constant.
When using a constant, the libc-test thinks this constant exists as an C equivalent.
1 parent 9b5659a commit 3966e4f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/unix/bsd/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ pub type pthread_t = ::uintptr_t;
1111
pub type nfds_t = ::c_uint;
1212

1313
#[cfg(not(target_os = "dragonfly"))]
14-
const UTSNAME_LEN: usize = 256;
14+
macro_rules! utsname_len { () => (256) }
1515
#[cfg(target_os = "dragonfly")]
16-
const UTSNAME_LEN: usize = 32;
16+
macro_rules! utsname_len { () => (32) }
1717

1818
s! {
1919
pub struct sockaddr {
@@ -90,11 +90,11 @@ s! {
9090
}
9191

9292
pub struct utsname {
93-
pub sysname: [::c_char; UTSNAME_LEN],
94-
pub nodename: [::c_char; UTSNAME_LEN],
95-
pub release: [::c_char; UTSNAME_LEN],
96-
pub version: [::c_char; UTSNAME_LEN],
97-
pub machine: [::c_char; UTSNAME_LEN],
93+
pub sysname: [::c_char; utsname_len!()],
94+
pub nodename: [::c_char; utsname_len!()],
95+
pub release: [::c_char; utsname_len!()],
96+
pub version: [::c_char; utsname_len!()],
97+
pub machine: [::c_char; utsname_len!()],
9898
}
9999

100100
pub struct msghdr {

0 commit comments

Comments
 (0)