On 27.01.2017 02:56, Marton Balint wrote: > I see 3 problems (wm4 explicitly named them, but I also had them in mind) > - Little benefit, yet > - Makes the code less clean, more cluttered > - Increases binary size > > The ideas I proposed (use macros, use common / factorized checks for common > validatons and errors) might be a good compromise IMHO. Fuzzing thereforce > can be done with "debug" builds. > > Anyway, I am not blocking the patch, just expressing what I would prefer in > the long run.
How about the following macro? #define FF_RETURN_ERROR(condition, error, log_ctx, ...) { \ if (condition) { \ if (!CONFIG_SMALL && log_ctx) \ av_log(log_ctx, AV_LOG_ERROR, __VA_ARGS__); \ return error; \ } \ } That could be used with error message: FF_RETURN_ERROR(st->codecpar->channels > FF_SANE_NB_CHANNELS, AVERROR(ENOSYS), s, "Too many channels %d > %d\n", st->codecpar->channels, FF_SANE_NB_CHANNELS) Or without: FF_RETURN_ERROR(st->codecpar->channels > FF_SANE_NB_CHANNELS, AVERROR(ENOSYS), NULL) Best regards, Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel