1
0
mirror of https://github.com/danog/libdvb.git synced 2024-11-26 20:04:39 +01:00

Macro hygiene

This commit is contained in:
Daniil Gentili 2022-03-27 20:29:56 +02:00
parent 983725c618
commit 4e8bf47e16
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 7 additions and 7 deletions

View File

@ -83,15 +83,15 @@ impl AsRawFd for FeDevice {
#[macro_export]
macro_rules! get_dtv_properties {
( $device:expr, $( $property:ident ),+ ) => { (|| -> ::anyhow::Result<_> {
let mut input = [ $( $property(DtvPropertyRequest::default()), )* ];
$device.get_properties(&mut input).context("Error fetching properties")?;
let mut input = [ $( $property($crate::fe::sys::DtvPropertyRequest::default()), )* ];
::anyhow::Context::context($device.get_properties(&mut input), "Error fetching properties")?;
let mut iterator = input.iter();
Ok((
$(
match iterator.next() {
::anyhow::Context::with_context(match iterator.next() {
Some($property(d)) => d.get(),
_ => ::anyhow::Result::Err(anyhow!("Missing value")),
}.with_context(|| format!("Error unpacking {}", stringify!($property)))?,
_ => ::anyhow::Result::Err(::anyhow::anyhow!("Missing value")),
}, || format!("Error unpacking {}", stringify!($property)))?,
)*
))
})()}
@ -101,7 +101,7 @@ macro_rules! get_dtv_properties {
macro_rules! set_dtv_properties {
( $device:expr, $( $property:ident($data:expr) ),+ ) => {
$device.set_properties(&[
$( $property(DtvPropertyRequest::new($data)), )*
$( $property($crate::fe::sys::DtvPropertyRequest::new($data)), )*
])
};
}

View File

@ -2,7 +2,7 @@ use crate::get_dtv_properties;
use {
super::{sys::*, FeDevice},
anyhow::{Context, Result},
anyhow::{Result},
std::fmt,
};