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.
This commit is contained in:
sfan5
2023-01-10 19:26:51 +01:00
parent 7b03cd367d
commit 1201d59f0b
21 changed files with 35 additions and 35 deletions

View File

@@ -702,7 +702,7 @@ static void convert_plane(int type, void *data, int num_samples)
break;
}
default:
abort();
MP_ASSERT_UNREACHABLE();
}
}

View File

@@ -563,7 +563,7 @@ static char *append_params(void *ta_parent, const char *device, const char *p)
/* a simple list of parameters: add it at the end of the list */
return talloc_asprintf(ta_parent, "%s,%s", device, p);
}
abort();
MP_ASSERT_UNREACHABLE();
}
static int try_open_device(struct ao *ao, const char *device, int mode)

View File

@@ -729,8 +729,9 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
GENERIC_ERR_MSG("pa_context_set_sink_input_mute() failed");
return CONTROL_ERROR;
}
} else
abort();
} else {
MP_ASSERT_UNREACHABLE();
}
return CONTROL_OK;
}