mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
tree-wide: drop unneeded output params
Neither of the callers of bus_deserialize_and_dump_unit_file_changes() touches the changes array, so let's simplify things and keep it internal to the function.
This commit is contained in:
parent
f643ca1767
commit
5e891cbb5c
|
@ -1755,15 +1755,11 @@ static int start_machine(int argc, char *argv[], void *userdata) {
|
|||
static int enable_machine(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
InstallChange *changes = NULL;
|
||||
size_t n_changes = 0;
|
||||
const char *method;
|
||||
sd_bus *bus = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
bool enable;
|
||||
|
||||
CLEANUP_ARRAY(changes, n_changes, install_changes_free);
|
||||
|
||||
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
|
||||
|
||||
enable = streq(argv[0], "enable");
|
||||
|
@ -1824,7 +1820,7 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
|
|||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
|
|
@ -556,13 +556,9 @@ static int maybe_enable_disable(sd_bus *bus, const char *path, bool enable) {
|
|||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_strv_free_ char **names = NULL;
|
||||
InstallChange *changes = NULL;
|
||||
const uint64_t flags = UNIT_FILE_PORTABLE | (arg_runtime ? UNIT_FILE_RUNTIME : 0);
|
||||
size_t n_changes = 0;
|
||||
int r;
|
||||
|
||||
CLEANUP_ARRAY(changes, n_changes, install_changes_free);
|
||||
|
||||
if (!arg_enable)
|
||||
return 0;
|
||||
|
||||
|
@ -599,7 +595,7 @@ static int maybe_enable_disable(sd_bus *bus, const char *path, bool enable) {
|
|||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
(void) bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
|
||||
(void) bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2708,14 +2708,13 @@ int bus_append_unit_property_assignment_many(sd_bus_message *m, UnitType t, char
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, InstallChange **changes, size_t *n_changes) {
|
||||
int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet) {
|
||||
const char *type, *path, *source;
|
||||
InstallChange *changes = NULL;
|
||||
size_t n_changes = 0;
|
||||
int r;
|
||||
|
||||
/* changes is dereferenced when calling install_changes_dump() later,
|
||||
* so we have to make sure this is not NULL. */
|
||||
assert(changes);
|
||||
assert(n_changes);
|
||||
CLEANUP_ARRAY(changes, n_changes, install_changes_free);
|
||||
|
||||
r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(sss)");
|
||||
if (r < 0)
|
||||
|
@ -2733,7 +2732,7 @@ int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, In
|
|||
continue;
|
||||
}
|
||||
|
||||
r = install_changes_add(changes, n_changes, t, path, source);
|
||||
r = install_changes_add(&changes, &n_changes, t, path, source);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
@ -2744,7 +2743,8 @@ int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, In
|
|||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
install_changes_dump(0, NULL, *changes, *n_changes, quiet);
|
||||
install_changes_dump(0, NULL, changes, n_changes, quiet);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u);
|
|||
int bus_append_unit_property_assignment(sd_bus_message *m, UnitType t, const char *assignment);
|
||||
int bus_append_unit_property_assignment_many(sd_bus_message *m, UnitType t, char **l);
|
||||
|
||||
int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, InstallChange **changes, size_t *n_changes);
|
||||
int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet);
|
||||
|
||||
int unit_load_state(sd_bus *bus, const char *name, char **load_state);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ int verb_add_dependency(int argc, char *argv[], void *userdata) {
|
|||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add dependency: %s", bus_error_message(&error, r));
|
||||
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ int verb_enable(int argc, char *argv[], void *userdata) {
|
|||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ int verb_preset_all(int argc, char *argv[], void *userdata) {
|
|||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to preset all units: %s", bus_error_message(&error, r));
|
||||
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ int verb_set_default(int argc, char *argv[], void *userdata) {
|
|||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to set default target: %s", bus_error_message(&error, r));
|
||||
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
|
||||
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
|
Loading…
Reference in a new issue