From dbae373978629aea0c29b6a4ba62e4cb2e2d0d4e Mon Sep 17 00:00:00 2001 From: John Millikin Date: Mon, 8 May 2023 15:02:16 +0900 Subject: [PATCH] Constify `CMSG_LEN` for all targets. --- src/fuchsia/mod.rs | 2 +- src/unix/aix/mod.rs | 2 +- src/unix/bsd/apple/mod.rs | 2 +- src/unix/bsd/freebsdlike/dragonfly/mod.rs | 2 +- src/unix/bsd/freebsdlike/freebsd/mod.rs | 2 +- src/unix/bsd/netbsdlike/netbsd/mod.rs | 2 +- src/unix/bsd/netbsdlike/openbsd/mod.rs | 2 +- src/unix/haiku/mod.rs | 2 +- src/unix/linux_like/mod.rs | 2 +- src/unix/nto/mod.rs | 2 +- src/unix/solarish/mod.rs | 2 +- src/vxworks/mod.rs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 6b121854138e9..3e922e766cba4 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -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::()) + len as ::size_t) as ::c_uint } } diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index ffe3f18284d72..325d7d654fd7e 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -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 } diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 66f03f67f653c..4b6ce9b4c3634 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -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 } diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index d323a43540b19..7d01e3e0d0374 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -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 } diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 6db9fa2c74e4b..633d1dac39c5c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -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 } diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 093b24fe95d10..de5ec3863e717 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -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 } diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index ef66311268b13..3b87dc211f236 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -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 } diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index c1a38f1b360dd..b34b7ca68f3ed 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -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::()) as ::c_uint + length } diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index e08bb7dbb05b0..b487da9fa91d9 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -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::()) as ::c_uint + length } diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index b8fcf9df8ee37..5d13568e43943 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -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 } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 48ab4dbb9288c..400de8a26471c 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -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 } diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 6b705e8a22c81..c337a82793e6a 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -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::()) as ::c_uint + length } }