From: Lennart Poettering Date: Tue, 23 Jul 2019 08:32:41 +0000 (+0200) Subject: logind: un-export and voidify a few functions X-Git-Tag: v243-rc1~56^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=290320effadc0a988524af7e88a70c064e6e602c;p=thirdparty%2Fsystemd.git logind: un-export and voidify a few functions Let's minimize scope of functions and make sure that functions that semantically should never fail can't return errors. --- diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 11cbb4534c5..ca2088150e8 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -24,6 +24,8 @@ #include "user-util.h" #include "util.h" +static void inhibitor_remove_fifo(Inhibitor *i); + int inhibitor_new(Inhibitor **ret, Manager *m, const char* id) { _cleanup_(inhibitor_freep) Inhibitor *i = NULL; int r; @@ -79,7 +81,7 @@ Inhibitor* inhibitor_free(Inhibitor *i) { return mfree(i); } -int inhibitor_save(Inhibitor *i) { +static int inhibitor_save(Inhibitor *i) { _cleanup_free_ char *temp_path = NULL; _cleanup_fclose_ FILE *f = NULL; int r; @@ -186,7 +188,7 @@ int inhibitor_start(Inhibitor *i) { return 0; } -int inhibitor_stop(Inhibitor *i) { +void inhibitor_stop(Inhibitor *i) { assert(i); if (i->started) @@ -203,8 +205,6 @@ int inhibitor_stop(Inhibitor *i) { i->started = false; bus_manager_send_inhibited_change(i); - - return 0; } int inhibitor_load(Inhibitor *i) { @@ -338,7 +338,7 @@ int inhibitor_create_fifo(Inhibitor *i) { return r; } -void inhibitor_remove_fifo(Inhibitor *i) { +static void inhibitor_remove_fifo(Inhibitor *i) { assert(i); i->event_source = sd_event_source_unref(i->event_source); diff --git a/src/login/logind-inhibit.h b/src/login/logind-inhibit.h index a5cec63ecd3..e04bc81a868 100644 --- a/src/login/logind-inhibit.h +++ b/src/login/logind-inhibit.h @@ -53,14 +53,12 @@ Inhibitor* inhibitor_free(Inhibitor *i); DEFINE_TRIVIAL_CLEANUP_FUNC(Inhibitor*, inhibitor_free); -int inhibitor_save(Inhibitor *i); int inhibitor_load(Inhibitor *i); int inhibitor_start(Inhibitor *i); -int inhibitor_stop(Inhibitor *i); +void inhibitor_stop(Inhibitor *i); int inhibitor_create_fifo(Inhibitor *i); -void inhibitor_remove_fifo(Inhibitor *i); 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);