mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 05:41:16 -03:00
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:
@@ -276,11 +276,6 @@ pub fn next(&mut self) -> Option<io::Result<&DirEntry>> {
|
||||
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"))]
|
||||
|
||||
Reference in New Issue
Block a user