1
0
Fork 0
forked from wry/wry

all: replace ustr literals by cstr literals

This commit is contained in:
Julian Orth 2024-07-09 10:03:39 +02:00
parent 1a0181f2ac
commit e2cb37c4d8
5 changed files with 17 additions and 21 deletions

View file

@ -4,7 +4,7 @@ use {
crate::utils::oserror::OsError,
std::{ffi::CStr, marker::PhantomData, ptr, rc::Rc},
thiserror::Error,
uapi::{c, ustr, Errno, IntoUstr, Ustr},
uapi::{c, Errno, IntoUstr},
};
#[repr(transparent)]
@ -375,7 +375,7 @@ impl UdevDevice {
unsafe { udev_device_get_is_initialized(self.device) != 0 }
}
fn get_property(&self, prop: &Ustr) -> Option<&CStr> {
fn get_property(&self, prop: &CStr) -> Option<&CStr> {
let prop = unsafe { udev_device_get_property_value(self.device, prop.as_ptr()) };
if prop.is_null() {
None
@ -385,15 +385,15 @@ impl UdevDevice {
}
pub fn vendor(&self) -> Option<&CStr> {
self.get_property(ustr!("ID_VENDOR_FROM_DATABASE"))
self.get_property(c"ID_VENDOR_FROM_DATABASE")
}
pub fn model(&self) -> Option<&CStr> {
self.get_property(ustr!("ID_MODEL_FROM_DATABASE"))
self.get_property(c"ID_MODEL_FROM_DATABASE")
}
pub fn pci_id(&self) -> Option<&CStr> {
self.get_property(ustr!("PCI_ID"))
self.get_property(c"PCI_ID")
}
}