hack cstr is_empty
This commit is contained in:
parent
d88f979437
commit
ddc02b0f32
@ -536,7 +536,8 @@ pub const fn as_ptr(&self) -> *const c_char {
|
||||
pub const fn is_empty(&self) -> bool {
|
||||
// SAFETY: We know there is at least one byte; for empty strings it
|
||||
// is the NUL terminator.
|
||||
(unsafe { self.inner.get_unchecked(0) }) == &0
|
||||
// FIXME(const-hack): use get_unchecked
|
||||
unsafe { *self.inner.as_ptr() == 0 }
|
||||
}
|
||||
|
||||
/// Converts this C string to a byte slice.
|
||||
|
Loading…
Reference in New Issue
Block a user