From 290320effadc0a988524af7e88a70c064e6e602c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 23 Jul 2019 10:32:41 +0200 Subject: [PATCH] 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. --- src/login/logind-inhibit.c | 10 +++++----- src/login/logind-inhibit.h | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 11cbb45..ca20881 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 a5cec63..e04bc81 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); -- 2.7.4