mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
core/unit: use assert for checking internal call sanity
The only way this could be called with an invalid value would be if somebody forgot to initialize unit type. In such cases, it's better to fail hard immediately.
This commit is contained in:
parent
fa5a025167
commit
ffcf54d4fb
@ -5079,10 +5079,7 @@ bool unit_type_supported(UnitType t) {
|
||||
static int8_t cache[_UNIT_TYPE_MAX] = {}; /* -1: disabled, 1: enabled: 0: don't know */
|
||||
int r;
|
||||
|
||||
if (_unlikely_(t < 0))
|
||||
return false;
|
||||
if (_unlikely_(t >= _UNIT_TYPE_MAX))
|
||||
return false;
|
||||
assert(t >= 0 && t < _UNIT_TYPE_MAX);
|
||||
|
||||
if (cache[t] == 0) {
|
||||
char *e;
|
||||
|
Loading…
Reference in New Issue
Block a user