]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: un-export and voidify a few functions
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Jul 2019 08:32:41 +0000 (10:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jul 2019 14:08:06 +0000 (16:08 +0200)
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
src/login/logind-inhibit.h

index 11cbb4534c5159fcf0374850aa531c42d28be63c..ca2088150e8946dca1112548488e562f286cd134 100644 (file)
@@ -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);
index a5cec63ecd36ea14735ad113fcf2c703c7a4b51e..e04bc81a8681e7a7232241f3516985b1f428aac4 100644 (file)
@@ -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);