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.
This commit is contained in:
Fabian Boehm 2024-11-11 17:48:11 +01:00
parent f0a3a5708f
commit 0ef811c86e

View File

@ -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<u8> = 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"))]