Skip to content

Commit

Permalink
Auto merge of #3241 - jmillikin:cmsg-macros-const-usize, r=JohnTitor
Browse files Browse the repository at this point in the history
Constify `CMSG_LEN` for all targets.
  • Loading branch information
bors committed May 8, 2023
2 parents 3b5109b + dbae373 commit 71420d4
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/fuchsia/mod.rs
Expand Up @@ -3271,7 +3271,7 @@ f! {
as ::c_uint
}

pub fn CMSG_LEN(len: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(len: ::c_uint) -> ::c_uint {
(CMSG_ALIGN(::mem::size_of::<cmsghdr>()) + len as ::size_t) as ::c_uint
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/aix/mod.rs
Expand Up @@ -2551,7 +2551,7 @@ f! {
(cmsg as *mut ::c_uchar).offset(::mem::size_of::<::cmsghdr>() as isize)
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
::mem::size_of::<::cmsghdr>() as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/apple/mod.rs
Expand Up @@ -5107,7 +5107,7 @@ f! {
as ::c_uint
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) + length as usize)
as ::c_uint
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/dragonfly/mod.rs
Expand Up @@ -1534,7 +1534,7 @@ f! {
.offset(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize)
as ::c_uint
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/mod.rs
Expand Up @@ -4717,7 +4717,7 @@ f! {
.offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/mod.rs
Expand Up @@ -2422,7 +2422,7 @@ f! {
.offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/mod.rs
Expand Up @@ -1705,7 +1705,7 @@ f! {
.offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/haiku/mod.rs
Expand Up @@ -1504,7 +1504,7 @@ f! {
as ::c_uint
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/linux_like/mod.rs
Expand Up @@ -1557,7 +1557,7 @@ f! {
as ::c_uint
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/nto/mod.rs
Expand Up @@ -2539,7 +2539,7 @@ f! {
.offset(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/solarish/mod.rs
Expand Up @@ -2601,7 +2601,7 @@ f! {
_CMSG_DATA_ALIGN(cmsg.offset(1) as usize) as *mut ::c_uchar
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
_CMSG_DATA_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
}

Expand Down
2 changes: 1 addition & 1 deletion src/vxworks/mod.rs
Expand Up @@ -1072,7 +1072,7 @@ f! {
as ::c_uint
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
}
}
Expand Down

0 comments on commit 71420d4

Please sign in to comment.