mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-19 05:13:44 +08: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:
parent
f0a3a5708f
commit
0ef811c86e
|
@ -276,11 +276,6 @@ impl DirIter {
|
||||||
return self.next();
|
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.reset();
|
||||||
self.entry.name = cstr2wcstring(&d_name);
|
self.entry.name = cstr2wcstring(&d_name);
|
||||||
#[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
|
#[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user