On Wed, 22 Feb 2017 19:16:46 +0100 Michael Niedermayer <mich...@niedermayer.cc> wrote:
> This enables the extra error messages in case of DEBUG or high assrtion > levels. > High assertion levels imply slow checks in inner loops so any extra error > should > be insignificant. > Is it preferred to have a separate switch for ff_elog() so it doesnt depend on > DEBUG/assertion level ? > > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > --- > libavutil/internal.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/libavutil/internal.h b/libavutil/internal.h > index 7780a9a791..208f8f474f 100644 > --- a/libavutil/internal.h > +++ b/libavutil/internal.h > @@ -262,6 +262,12 @@ void avpriv_request_sample(void *avc, > # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, > __VA_ARGS__); } while (0) > #endif > > +#if defined(DEBUG) || ASSERT_LEVEL > 1 > +# define ff_elog(ctx, ...) av_log(ctx, AV_LOG_ERROR, __VA_ARGS__) > +#else > +# define ff_elog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_ERROR, > __VA_ARGS__); } while (0) > +#endif > + > // For debuging we use signed operations so overflows can be detected (by > ubsan) > // For production we use unsigned so there are no undefined operations > #ifdef CHECKED Not really a fan of this. (And neither ff_dlog.) But I guess I don't mean to stop you. In my opinion, code that checks for overflow and fuzz issues should be as small and unintrusive as possible, or preferably not exist. It seems like all these fuzz fixes make code less readable. (Not just because of the additional logging and control flow, also because of all those unobvious tricky checks.) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel