Skip to content

Commit

Permalink
Remove bstr dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 1, 2024
1 parent 5c40b60 commit 6c1ef4a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ ntapi = { version = "0.4", optional = true }
# versions when bumping to a new release, and only increase the minimum when absolutely necessary.
windows = { version = ">=0.54, <=0.57", optional = true }

[target.'cfg(any(windows, target_os = "linux", target_os = "android"))'.dependencies]
bstr = "1.9.0"

[target.'cfg(not(any(target_os = "unknown", target_arch = "wasm32")))'.dependencies]
libc = "^0.2.153"

Expand Down
5 changes: 2 additions & 3 deletions examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![allow(unused_must_use, non_upper_case_globals)]
#![allow(clippy::manual_range_contains)]

use bstr::ByteSlice;
use std::io::{self, BufRead, Write};
use std::str::FromStr;
use sysinfo::{Components, Disks, Networks, Pid, Signal, System, Users};
Expand Down Expand Up @@ -243,7 +242,7 @@ fn interpret_input(
&mut io::stdout(),
"{}:{} status={:?}",
pid,
proc_.name().as_encoded_bytes().as_bstr(),
proc_.name().to_string_lossy(),
proc_.status()
);
}
Expand Down Expand Up @@ -294,7 +293,7 @@ fn interpret_input(
writeln!(
&mut io::stdout(),
"==== {} ====",
proc_.name().as_encoded_bytes().as_bstr()
proc_.name().to_string_lossy()
);
writeln!(&mut io::stdout(), "{proc_:?}");
}
Expand Down
3 changes: 1 addition & 2 deletions src/unix/linux/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::path::{Path, PathBuf};
use std::str::{self, FromStr};
use std::sync::atomic::{AtomicUsize, Ordering};

use bstr::ByteSlice;
use libc::{c_ulong, gid_t, kill, uid_t};

use crate::sys::system::SystemInfo;
Expand Down Expand Up @@ -815,7 +814,7 @@ fn copy_from_file(entry: &Path) -> Vec<OsString> {
let mut out = Vec::with_capacity(10);
let mut data = data.as_slice();
while let Some(pos) = data.iter().position(|c| *c == 0) {
let s = &data[..pos].trim();
let s = &data[..pos].trim_ascii();
if !s.is_empty() {
out.push(OsStr::from_bytes(s).to_os_string());
}
Expand Down

0 comments on commit 6c1ef4a

Please sign in to comment.