From 0ef811c86ee8d2a8ec7a6798a9f68634d5c80b71 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Mon, 11 Nov 2024 17:48:11 +0100 Subject: [PATCH] dir_iter: Remove duplicate NUL-removal This goes over the d_name twice. Filenames already cannot contain NUL (the C-api cannot express it!), so we don't need to scan them. --- src/wutil/dir_iter.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/wutil/dir_iter.rs b/src/wutil/dir_iter.rs index 4d47c3801..88f140637 100644 --- a/src/wutil/dir_iter.rs +++ b/src/wutil/dir_iter.rs @@ -276,11 +276,6 @@ impl DirIter { return self.next(); } - let nul_pos = dent.d_name.iter().position(|b| *b == 0).unwrap(); - let d_name: Vec = dent.d_name[..nul_pos + 1] - .iter() - .map(|b| *b as u8) - .collect(); self.entry.reset(); self.entry.name = cstr2wcstring(&d_name); #[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]