diff options
author | sfan5 <sfan5@live.de> | 2023-01-10 19:26:51 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-01-12 22:02:07 +0100 |
commit | 1201d59f0b5b8acc93f15904b745ec342548f9c1 (patch) | |
tree | 5eba78a5fa4dd68b5c750eb2b6ab5bc76d92ffd0 /demux | |
parent | 7b03cd367dd5416a4728ccea7e47dcd2827cbab7 (diff) | |
download | mpv-1201d59f0b5b8acc93f15904b745ec342548f9c1.tar.bz2 mpv-1201d59f0b5b8acc93f15904b745ec342548f9c1.tar.xz |
various: replace abort() with MP_ASSERT_UNREACHABLE() where appropriate
In debug mode the macro causes an assertion failure.
In release mode it works differently and tells the compiler that it can
assume the codepath will never execute. For this reason I was conversative
in replacing it, e.g. in mpv-internal code that exhausts all valid values
of an enum or when a condition is clear from directly preceding code.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux.c | 2 | ||||
-rw-r--r-- | demux/ebml.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/demux/demux.c b/demux/demux.c index 15ed27af73..913fe96f95 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -2868,7 +2868,7 @@ static const char *d_level(enum demux_check level) case DEMUX_CHECK_REQUEST:return "request"; case DEMUX_CHECK_NORMAL: return "normal"; } - abort(); + MP_ASSERT_UNREACHABLE(); } static int decode_float(char *str, float *out) diff --git a/demux/ebml.c b/demux/ebml.c index 5bb8fd83d3..98f86ac742 100644 --- a/demux/ebml.c +++ b/demux/ebml.c @@ -429,7 +429,7 @@ static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target, uint32_t, num_elems[i]); break; default: - abort(); + MP_ASSERT_UNREACHABLE(); } } } @@ -582,7 +582,7 @@ static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target, MP_TRACE(ctx, "ebml_id %x\n", (unsigned)*idptr); break; default: - abort(); + MP_ASSERT_UNREACHABLE(); } *countptr += 1; error: |