mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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:
@@ -702,7 +702,7 @@ static void convert_plane(int type, void *data, int num_samples)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
abort();
|
||||
MP_ASSERT_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user