diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2022-12-23 08:39:09 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2022-12-23 08:39:09 +0100 |
commit | 71d7f39706f0f5004820f8d1d36c87d5f9ec3e97 (patch) | |
tree | 1938481028914a91b4f98d95675360d695febec9 /nihav-flash/src | |
parent | a970b2110488aeff5855743d1728ee83462e8306 (diff) | |
download | nihav-71d7f39706f0f5004820f8d1d36c87d5f9ec3e97.tar.gz |
make validate!() print message only in debug builds
Diffstat (limited to 'nihav-flash/src')
-rw-r--r-- | nihav-flash/src/codecs/mod.rs | 5 | ||||
-rw-r--r-- | nihav-flash/src/demuxers/mod.rs | 5 | ||||
-rw-r--r-- | nihav-flash/src/muxers/mod.rs | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/nihav-flash/src/codecs/mod.rs b/nihav-flash/src/codecs/mod.rs index 906c3ec..74525fb 100644 --- a/nihav-flash/src/codecs/mod.rs +++ b/nihav-flash/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_flv263")] mod flv263; diff --git a/nihav-flash/src/demuxers/mod.rs b/nihav-flash/src/demuxers/mod.rs index a06fc48..fa46f34 100644 --- a/nihav-flash/src/demuxers/mod.rs +++ b/nihav-flash/src/demuxers/mod.rs @@ -2,9 +2,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_flv")] mod flv; diff --git a/nihav-flash/src/muxers/mod.rs b/nihav-flash/src/muxers/mod.rs index 692c5ad..edb87e3 100644 --- a/nihav-flash/src/muxers/mod.rs +++ b/nihav-flash/src/muxers/mod.rs @@ -1,9 +1,14 @@ use nihav_core::muxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(MuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(MuxerError::InvalidData); } }; +} #[cfg(feature="muxer_flv")] mod flv; |