Use rust idiom for listing radios
This commit is contained in:
parent
7793870f59
commit
4f082277d8
12
src/radio.rs
12
src/radio.rs
@ -183,18 +183,10 @@ pub fn list() {
|
|||||||
println!("Supported radios:");
|
println!("Supported radios:");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut ptr = get_radio_tab();
|
for (_, device) in RADIO_TABLE.iter() {
|
||||||
loop {
|
let name_ptr = (*device).name;
|
||||||
let ident_ptr = (*ptr).ident;
|
|
||||||
if ident_ptr.is_null() {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let name_ptr = (*(*ptr).device).name;
|
|
||||||
|
|
||||||
let name = CStr::from_ptr(name_ptr).to_str().unwrap().to_string();
|
let name = CStr::from_ptr(name_ptr).to_str().unwrap().to_string();
|
||||||
println!(" {}", name);
|
println!(" {}", name);
|
||||||
|
|
||||||
ptr = ptr.offset(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user