From: Yu Watanabe Date: Mon, 7 Jan 2019 17:43:00 +0000 (+0900) Subject: login: simplify the condtion in assertion and slightly decrease binary size X-Git-Tag: v241-rc1~94^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11350%2Fhead;p=thirdparty%2Fsystemd.git login: simplify the condtion in assertion and slightly decrease binary size --- diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index bb3f6b84519..8ab498fdc29 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1474,23 +1474,15 @@ int manager_set_lid_switch_ignore(Manager *m, usec_t until) { } static int send_prepare_for(Manager *m, InhibitWhat w, bool _active) { - - static const char * const signal_name[_INHIBIT_WHAT_MAX] = { - [INHIBIT_SHUTDOWN] = "PrepareForShutdown", - [INHIBIT_SLEEP] = "PrepareForSleep" - }; - int active = _active; assert(m); - assert(w >= 0); - assert(w < _INHIBIT_WHAT_MAX); - assert(signal_name[w]); + assert(IN_SET(w, INHIBIT_SHUTDOWN, INHIBIT_SLEEP)); return sd_bus_emit_signal(m->bus, "/org/freedesktop/login1", "org.freedesktop.login1.Manager", - signal_name[w], + w == INHIBIT_SHUTDOWN ? "PrepareForShutdown" : "PrepareForSleep", "b", active); }