Use silly hack to remove macro case

master
not manx 4 years ago
parent be819c3e29
commit 0e08c743b8
Signed by: C-xC-c
GPG Key ID: F52ED472284EF2F4

@ -26,17 +26,7 @@ pub fn get_users() -> std::vec::Vec<Passwd> {
let mut users = vec!();
unsafe {
// This could maybe be simplified but there's no point
macro_rules! from_cstr {
($x:expr, $fmt:literal) => {
match std::ffi::CStr::from_ptr($x).to_owned().into_string() {
Ok(v) => v,
Err(v) => {
warn!($fmt, v);
continue;
}
}
};
($x:expr, $fmt:literal, $usr:expr) => {
match std::ffi::CStr::from_ptr($x).to_owned().into_string() {
Ok(v) => v,
@ -60,7 +50,8 @@ pub fn get_users() -> std::vec::Vec<Passwd> {
let my_passwd = *passwd;
let name = from_cstr!(
my_passwd.pw_name,
"User {} has invalid UTF-8 characters, skipping"
"{}User {} has invalid UTF-8 characters, skipping",
"" // Lol
);
users.push(Passwd{

Loading…
Cancel
Save