bool inhibited = false;
assert(m);
- assert(w > 0 && w < _INHIBIT_WHAT_MAX);
+ assert(w > 0);
+ assert(w < _INHIBIT_WHAT_MAX);
HASHMAP_FOREACH(i, m->inhibitors) {
if (!i->started)
"handle-reboot-key")+1];
char *p;
- if (w < 0 || w >= _INHIBIT_WHAT_MAX)
+ if (!inhibit_what_is_valid(w))
return NULL;
p = buffer;
InhibitWhat manager_inhibit_what(Manager *m, InhibitMode mm);
bool manager_is_inhibited(Manager *m, InhibitWhat w, InhibitMode mm, dual_timestamp *since, bool ignore_inactive, bool ignore_uid, uid_t uid, Inhibitor **offending);
+static inline bool inhibit_what_is_valid(InhibitWhat w) {
+ return w > 0 && w < _INHIBIT_WHAT_MAX;
+}
+
const char *inhibit_what_to_string(InhibitWhat k);
int inhibit_what_from_string(const char *s);