diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-27 14:52:13 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-01 14:21:56 +0200 |
commit | e157b21a9081e3c4e8e22a4ae764dfbf0cc5b5b3 (patch) | |
tree | 9e7110ddf324b92f4e0cbf2324932f4ed9c6731e /fftools/cmdutils.h | |
parent | 319e8a49b5bcfa80fcb6f50f0dd78c6408c972ae (diff) | |
download | ffmpeg-e157b21a9081e3c4e8e22a4ae764dfbf0cc5b5b3.tar.gz |
fftools/cmdutils: Add function to report error before exit
This is designed to improve and unify error handling for
allocation failures for the many (often small) allocations that we have
in the fftools. These typically either don't return an error message
or an error message that is not really helpful to the user
and can be replaced by a generic error message without loss of
information.
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools/cmdutils.h')
-rw-r--r-- | fftools/cmdutils.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h index d87e162ccd..4496221983 100644 --- a/fftools/cmdutils.h +++ b/fftools/cmdutils.h @@ -55,6 +55,17 @@ extern int hide_banner; void register_exit(void (*cb)(int ret)); /** + * Reports an error corresponding to the provided + * AVERROR code and calls exit_program() with the + * corresponding POSIX error code. + * @note ret must be an AVERROR-value of a POSIX error code + * (i.e. AVERROR(EFOO) and not AVERROR_FOO). + * library functions can return both, so call this only + * with AVERROR(EFOO) of your own. + */ +void report_and_exit(int ret) av_noreturn; + +/** * Wraps exit with a program-specific cleanup routine. */ void exit_program(int ret) av_noreturn; |