//! Small shared helpers for converting between C strings and Rust strings at
//! the FFI boundary.
// `unreachable_pub` (stable, enabled) wants `pub(crate)` on these free functions
// in this private module, but `redundant_pub_crate` (nursery) then flags that as
// redundant. The two lints are in direct conflict here; defer to the stable one.
use ;
/// Borrow a C string as `&str`. ATC data is ASCII, so we fall back to `""` on
/// the rare non-UTF-8 byte or null. The result borrows `'a`.
///
/// # Safety
/// `ptr` must be null or a valid NUL-terminated string that outlives `'a`.
pub unsafe
/// Build a `CString` from `&str`, dropping any interior NUL bytes rather than
/// failing.
///
/// `CString::new` errors on an interior NUL (it would truncate the C string).
/// EuroScope's data is NUL-free in practice, so instead of surfacing a `Result`
/// through every setter we strip the offending bytes and retry — the second
/// construction cannot fail because the input is now guaranteed NUL-free.
pub