mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
`strlen` was both unused and unneeded. Rust's `CStr` handles the length for us without needing to call into `libc` manually or implementing our own version of `strlen`. Our `strlen` implemented a fallback that incremented and dereferenced a pointer to check for NUL. This is slower than what `libc` usually does. For example, `musl` operates on words instead of individual bytes. This implementation also caused UB if the caller passed in a null pointer. `wcslen` is similar. The currently implementation can cause UB for null pointers. It's also slow from the same reason mentioned above. Luckily, the widestring crate can handle this for us. The crate panics on null pointers, so using it was a good excuse to use NonNull in more places.
93 lines
2.8 KiB
TOML
93 lines
2.8 KiB
TOML
[package]
|
|
name = "rustpython-host_env"
|
|
description = "Host OS API abstractions for RustPython"
|
|
version.workspace = true
|
|
authors.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
license.workspace = true
|
|
|
|
[dependencies]
|
|
rustpython-wtf8 = { workspace = true }
|
|
|
|
bitflags = { workspace = true }
|
|
getrandom = { workspace = true }
|
|
libc = { workspace = true }
|
|
num-traits = { workspace = true }
|
|
parking_lot = { workspace = true }
|
|
paste = { workspace = true }
|
|
widestring = { workspace = true }
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
nix = { workspace = true }
|
|
|
|
[target.'cfg(any(unix, target_os = "macos", target_os = "redox", target_os = "wasi"))'.dependencies]
|
|
rustix = { workspace = true }
|
|
|
|
[target.'cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))'.dependencies]
|
|
num_cpus = "1.17.0"
|
|
|
|
[target.'cfg(not(any(target_os = "ios", target_os = "android", target_os = "windows", target_arch = "wasm32", target_os = "redox")))'.dependencies]
|
|
mac_address = { workspace = true }
|
|
|
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
|
dns-lookup = { workspace = true }
|
|
gethostname = { workspace = true }
|
|
rustyline = { workspace = true }
|
|
socket2 = { workspace = true, features = ["all"] }
|
|
which = { workspace = true }
|
|
|
|
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "redox")))'.dependencies]
|
|
termios = { workspace = true }
|
|
|
|
[target.'cfg(any(unix, windows))'.dependencies]
|
|
memmap2 = "0.9.10"
|
|
libloading = "0.9"
|
|
|
|
[target.'cfg(all(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "android"), not(any(target_env = "musl", target_env = "sgx"))))'.dependencies]
|
|
libffi = { workspace = true, features = ["system"] }
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
system-configuration = { workspace = true }
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
memchr.workspace = true
|
|
junction = { workspace = true }
|
|
schannel = { workspace = true }
|
|
windows-sys = { workspace = true, features = [
|
|
"Win32_Foundation",
|
|
"Win32_Globalization",
|
|
"Win32_NetworkManagement_IpHelper",
|
|
"Win32_NetworkManagement_Ndis",
|
|
"Win32_Networking_WinSock",
|
|
"Win32_Security",
|
|
"Win32_Security_Authorization",
|
|
"Win32_Storage_FileSystem",
|
|
"Win32_System_Console",
|
|
"Win32_System_Diagnostics_Debug",
|
|
"Win32_System_Environment",
|
|
"Win32_System_IO",
|
|
"Win32_System_Ioctl",
|
|
"Win32_System_JobObjects",
|
|
"Win32_System_Kernel",
|
|
"Win32_System_LibraryLoader",
|
|
"Win32_System_Memory",
|
|
"Win32_System_Pipes",
|
|
"Win32_System_Performance",
|
|
"Win32_System_Registry",
|
|
"Win32_System_SystemInformation",
|
|
"Win32_System_SystemServices",
|
|
"Win32_System_Threading",
|
|
"Win32_System_Time",
|
|
"Win32_System_WindowsProgramming",
|
|
"Win32_UI_Shell",
|
|
"Win32_UI_WindowsAndMessaging",
|
|
] }
|
|
|
|
[build-dependencies]
|
|
cc = "1"
|
|
|
|
[lints]
|
|
workspace = true
|