From 4f082277d816ff19e8a2ecc0f30fc65173f70083 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Mon, 1 Mar 2021 02:57:53 -0800 Subject: [PATCH] Use rust idiom for listing radios --- src/radio.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/radio.rs b/src/radio.rs index ba7440a..381c4d2 100644 --- a/src/radio.rs +++ b/src/radio.rs @@ -183,18 +183,10 @@ pub fn list() { println!("Supported radios:"); unsafe { - let mut ptr = get_radio_tab(); - loop { - let ident_ptr = (*ptr).ident; - if ident_ptr.is_null() { - break; - } - let name_ptr = (*(*ptr).device).name; - + for (_, device) in RADIO_TABLE.iter() { + let name_ptr = (*device).name; let name = CStr::from_ptr(name_ptr).to_str().unwrap().to_string(); println!(" {}", name); - - ptr = ptr.offset(1); } } }