mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user