diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 18:50:43 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 18:56:16 +0100 |
commit | f647962d64e844689f3e2acfce6102fc47e76df2 (patch) | |
tree | dcaf5e38de1d4e31f73f540bc85532ceb72cfa6b /src/machine/machined.c | |
parent | e80733be33e52d8ab2f1ae845326d39c600f5612 (diff) |
treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
'local $/;
local $_=<>;
s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
print;'
$f
done
And a couple of manual whitespace fixups.
Diffstat (limited to 'src/machine/machined.c')
-rw-r--r-- | src/machine/machined.c | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/src/machine/machined.c b/src/machine/machined.c index 2385fead6e..d1c10d2a26 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -137,28 +137,20 @@ static int manager_connect_bus(Manager *m) { assert(!m->bus); r = sd_bus_default_system(&m->bus); - if (r < 0) { - log_error_errno(r, "Failed to connect to system bus: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to connect to system bus: %m"); r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", manager_vtable, m); - if (r < 0) { - log_error_errno(r, "Failed to add manager object vtable: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add manager object vtable: %m"); r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/machine1/machine", "org.freedesktop.machine1.Machine", machine_vtable, machine_object_find, m); - if (r < 0) { - log_error_errno(r, "Failed to add machine object vtable: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add machine object vtable: %m"); r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/machine1/machine", machine_node_enumerator, m); - if (r < 0) { - log_error_errno(r, "Failed to add machine enumerator: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add machine enumerator: %m"); r = sd_bus_add_match(m->bus, NULL, @@ -169,10 +161,8 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_job_removed, m); - if (r < 0) { - log_error_errno(r, "Failed to add match for JobRemoved: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add match for JobRemoved: %m"); r = sd_bus_add_match(m->bus, NULL, @@ -183,10 +173,8 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_unit_removed, m); - if (r < 0) { - log_error_errno(r, "Failed to add match for UnitRemoved: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add match for UnitRemoved: %m"); r = sd_bus_add_match(m->bus, NULL, @@ -196,10 +184,8 @@ static int manager_connect_bus(Manager *m) { "member='PropertiesChanged'", match_properties_changed, m); - if (r < 0) { - log_error_errno(r, "Failed to add match for PropertiesChanged: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add match for PropertiesChanged: %m"); r = sd_bus_add_match(m->bus, NULL, @@ -210,10 +196,8 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_reloading, m); - if (r < 0) { - log_error_errno(r, "Failed to add match for Reloading: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add match for Reloading: %m"); r = sd_bus_call_method( m->bus, @@ -229,16 +213,12 @@ static int manager_connect_bus(Manager *m) { } r = sd_bus_request_name(m->bus, "org.freedesktop.machine1", 0); - if (r < 0) { - log_error_errno(r, "Failed to register name: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to register name: %m"); r = sd_bus_attach_event(m->bus, m->event, 0); - if (r < 0) { - log_error_errno(r, "Failed to attach bus to event loop: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to attach bus to event loop: %m"); return 0; } |