Somewhat reduce size of allocation of receive_with_names
This commit is contained in:
parent
34f2da2d9b
commit
33aabb14d7
|
@ -132,7 +132,7 @@ impl FileDescriptor {
|
|||
) -> Result<impl IntoIterator<Item = (Self, OsString)>, ReceiveNameError> {
|
||||
let fd_names = env::var_os(FD_NAMES_VAR).ok_or(ReceiveNameError::NoListenFDName)?;
|
||||
tracing::trace!("{FD_NAMES_VAR} = {fd_names:?}");
|
||||
let fd_names = fd_names
|
||||
let fd_names: Vec<_> = fd_names
|
||||
.as_encoded_bytes()
|
||||
.split(|b| *b == b':')
|
||||
.map(|name| {
|
||||
|
@ -141,11 +141,11 @@ impl FileDescriptor {
|
|||
// - Only split with ASCII colon which is a non-empty UTF-8 substring
|
||||
unsafe { OsStr::from_encoded_bytes_unchecked(name) }
|
||||
})
|
||||
.map(OsStr::to_os_string);
|
||||
.map(OsStr::to_os_string)
|
||||
.collect();
|
||||
Ok(Self::receive(unset_env)?
|
||||
.into_iter()
|
||||
.zip(fd_names)
|
||||
.collect::<Vec<_>>())
|
||||
.zip(fd_names))
|
||||
}
|
||||
|
||||
fn from_fds(num_fds: usize) -> Result<impl IntoIterator<Item = FileDescriptor>, GetFdsError> {
|
||||
|
|
Loading…
Reference in a new issue