diff mbox series

[FFmpeg-devel,1/8] fftools/ffmpeg_demux: replace abort() by av_assert0(0)

Message ID 20240105164251.28935-1-anton@khirnov.net
State Accepted
Commit f8939bad1e9d25c30bc22e205376457c446c6734
Headers show
Series [FFmpeg-devel,1/8] fftools/ffmpeg_demux: replace abort() by av_assert0(0) | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Jan. 5, 2024, 4:42 p.m. UTC
This is the standard way to mark unreachable cases in a switch
---
 fftools/ffmpeg_demux.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stefano Sabatini Jan. 6, 2024, 11:18 a.m. UTC | #1
On date Friday 2024-01-05 17:42:44 +0100, Anton Khirnov wrote:
> This is the standard way to mark unreachable cases in a switch
> ---
>  fftools/ffmpeg_demux.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
> index 95af31e9ef..5d07b7153d 100644
> --- a/fftools/ffmpeg_demux.c
> +++ b/fftools/ffmpeg_demux.c
> @@ -1223,8 +1223,7 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
>      case AVMEDIA_TYPE_ATTACHMENT:
>      case AVMEDIA_TYPE_UNKNOWN:
>          break;
> -    default:
> -        abort();
> +    default: av_assert0(0);

LGTM, also probably we might employ a self-documentation trick of the
kind:
av_assert0(!"handled media type");
diff mbox series

Patch

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 95af31e9ef..5d07b7153d 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1223,8 +1223,7 @@  static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
     case AVMEDIA_TYPE_ATTACHMENT:
     case AVMEDIA_TYPE_UNKNOWN:
         break;
-    default:
-        abort();
+    default: av_assert0(0);
     }
 
     ist->par = avcodec_parameters_alloc();