tree-wide: do not assign values if not used

This commit is contained in:
Yu Watanabe 2018-06-19 14:09:13 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent 496ab389cc
commit 31d99bd172
5 changed files with 29 additions and 31 deletions

View File

@ -226,10 +226,10 @@ static int list_users(int argc, char *argv[], void *userdata) {
(void) table_set_align_percent(table, TABLE_HEADER_CELL(0), 100);
for (;;) {
const char *user, *object;
const char *user;
uint32_t uid;
r = sd_bus_message_read(reply, "(uso)", &uid, &user, &object);
r = sd_bus_message_read(reply, "(uso)", &uid, &user, NULL);
if (r < 0)
return bus_log_parse_error(r);
if (r == 0)
@ -281,9 +281,9 @@ static int list_seats(int argc, char *argv[], void *userdata) {
return log_oom();
for (;;) {
const char *seat, *object;
const char *seat;
r = sd_bus_message_read(reply, "(so)", &seat, &object);
r = sd_bus_message_read(reply, "(so)", &seat, NULL);
if (r < 0)
return bus_log_parse_error(r);
if (r == 0)

View File

@ -299,9 +299,9 @@ static int list_machines(int argc, char *argv[], void *userdata) {
for (;;) {
_cleanup_free_ char *os = NULL, *version_id = NULL, *addresses = NULL;
const char *name, *class, *service, *object;
const char *name, *class, *service;
r = sd_bus_message_read(reply, "(ssso)", &name, &class, &service, &object);
r = sd_bus_message_read(reply, "(ssso)", &name, &class, &service, NULL);
if (r < 0)
return bus_log_parse_error(r);
if (r == 0)
@ -380,13 +380,13 @@ static int list_images(int argc, char *argv[], void *userdata) {
return bus_log_parse_error(r);
for (;;) {
const char *name, *type, *object;
uint64_t crtime, mtime, size;
const char *name, *type;
TableCell *cell;
bool ro_bool;
int ro_int;
r = sd_bus_message_read(reply, "(ssbttto)", &name, &type, &ro_int, &crtime, &mtime, &size, &object);
r = sd_bus_message_read(reply, "(ssbttto)", &name, &type, &ro_int, &crtime, &mtime, &size, NULL);
if (r < 0)
return bus_log_parse_error(r);
if (r == 0)
@ -1413,7 +1413,7 @@ static int login_machine(int argc, char *argv[], void *userdata) {
_cleanup_(sd_event_unrefp) sd_event *event = NULL;
int master = -1, r;
sd_bus *bus = userdata;
const char *pty, *match, *machine;
const char *match, *machine;
assert(bus);
@ -1464,7 +1464,7 @@ static int login_machine(int argc, char *argv[], void *userdata) {
return r;
}
r = sd_bus_message_read(reply, "hs", &master, &pty);
r = sd_bus_message_read(reply, "hs", &master, NULL);
if (r < 0)
return bus_log_parse_error(r);
@ -1479,7 +1479,7 @@ static int shell_machine(int argc, char *argv[], void *userdata) {
_cleanup_(sd_event_unrefp) sd_event *event = NULL;
int master = -1, r;
sd_bus *bus = userdata;
const char *pty, *match, *machine, *path;
const char *match, *machine, *path;
_cleanup_free_ char *uid = NULL;
assert(bus);
@ -1555,7 +1555,7 @@ static int shell_machine(int argc, char *argv[], void *userdata) {
return r;
}
r = sd_bus_message_read(reply, "hs", &master, &pty);
r = sd_bus_message_read(reply, "hs", &master, NULL);
if (r < 0)
return bus_log_parse_error(r);
@ -1799,7 +1799,6 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
UnitFileChange *changes = NULL;
size_t n_changes = 0;
int carries_install_info = 0;
const char *method = NULL;
sd_bus *bus = userdata;
int r, i;
@ -1862,7 +1861,7 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
}
if (streq(argv[0], "enable")) {
r = sd_bus_message_read(reply, "b", carries_install_info);
r = sd_bus_message_read(reply, "b", NULL);
if (r < 0)
return bus_log_parse_error(r);
}
@ -1999,7 +1998,7 @@ static int transfer_image_common(sd_bus *bus, sd_bus_message *m) {
return r;
}
r = sd_bus_message_read(reply, "uo", &id, &path);
r = sd_bus_message_read(reply, "uo", &id, NULL);
if (r < 0)
return bus_log_parse_error(r);
@ -2415,7 +2414,7 @@ static int list_transfers(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_free_ TransferInfo *transfers = NULL;
size_t n_transfers = 0, n_allocated = 0, j;
const char *type, *remote, *local, *object;
const char *type, *remote, *local;
sd_bus *bus = userdata;
uint32_t id, max_id = 0;
double progress;
@ -2440,7 +2439,7 @@ static int list_transfers(int argc, char *argv[], void *userdata) {
if (r < 0)
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(reply, "(usssdo)", &id, &type, &remote, &local, &progress, &object)) > 0) {
while ((r = sd_bus_message_read(reply, "(usssdo)", &id, &type, &remote, &local, &progress, NULL)) > 0) {
size_t l;
if (!GREEDY_REALLOC(transfers, n_allocated, n_transfers + 1))

View File

@ -489,7 +489,7 @@ enum nss_status _nss_mymachines_getpwuid_r(
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message* reply = NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
const char *machine, *object;
const char *machine;
uint32_t mapped;
int r;
@ -525,7 +525,7 @@ enum nss_status _nss_mymachines_getpwuid_r(
goto fail;
}
r = sd_bus_message_read(reply, "sou", &machine, &object, &mapped);
r = sd_bus_message_read(reply, "sou", &machine, NULL, &mapped);
if (r < 0)
goto fail;
@ -663,7 +663,7 @@ enum nss_status _nss_mymachines_getgrgid_r(
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message* reply = NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
const char *machine, *object;
const char *machine;
uint32_t mapped;
int r;
@ -699,7 +699,7 @@ enum nss_status _nss_mymachines_getgrgid_r(
goto fail;
}
r = sd_bus_message_read(reply, "sou", &machine, &object, &mapped);
r = sd_bus_message_read(reply, "sou", &machine, NULL, &mapped);
if (r < 0)
goto fail;

View File

@ -510,13 +510,13 @@ static int list_images(int argc, char *argv[], void *userdata) {
return bus_log_parse_error(r);
for (;;) {
const char *name, *type, *state, *object;
const char *name, *type, *state;
uint64_t crtime, mtime, usage;
TableCell *cell;
bool ro_bool;
int ro_int;
r = sd_bus_message_read(reply, "(ssbtttso)", &name, &type, &ro_int, &crtime, &mtime, &usage, &state, &object);
r = sd_bus_message_read(reply, "(ssbtttso)", &name, &type, &ro_int, &crtime, &mtime, &usage, &state, NULL);
if (r < 0)
return bus_log_parse_error(r);
if (r == 0)

View File

@ -2145,7 +2145,7 @@ finish:
static int output_waiting_jobs(sd_bus *bus, uint32_t id, const char *method, const char *prefix) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
const char *name, *type, *state, *job_path, *unit_path;
const char *name, *type;
uint32_t other_id;
int r;
@ -2167,7 +2167,7 @@ static int output_waiting_jobs(sd_bus *bus, uint32_t id, const char *method, con
if (r < 0)
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(reply, "(usssoo)", &other_id, &name, &type, &state, &job_path, &unit_path)) > 0)
while ((r = sd_bus_message_read(reply, "(usssoo)", &other_id, &name, &type, NULL, NULL, NULL)) > 0)
printf("%s %u (%s/%s)\n", prefix, other_id, name, type);
if (r < 0)
return bus_log_parse_error(r);
@ -2268,14 +2268,14 @@ static bool output_show_job(struct job_info *job, char **patterns) {
static int list_jobs(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
const char *name, *type, *state, *job_path, *unit_path;
_cleanup_free_ struct job_info *jobs = NULL;
const char *name, *type, *state;
bool skipped = false;
size_t size = 0;
unsigned c = 0;
sd_bus *bus;
uint32_t id;
int r;
bool skipped = false;
r = acquire_bus(BUS_MANAGER, &bus);
if (r < 0)
@ -2297,7 +2297,7 @@ static int list_jobs(int argc, char *argv[], void *userdata) {
if (r < 0)
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(reply, "(usssoo)", &id, &name, &type, &state, &job_path, &unit_path)) > 0) {
while ((r = sd_bus_message_read(reply, "(usssoo)", &id, &name, &type, &state, NULL, NULL)) > 0) {
struct job_info job = { id, name, type, state };
if (!output_show_job(&job, strv_skip(argv, 1))) {
@ -4401,11 +4401,10 @@ static int map_main_pid(sd_bus *bus, const char *member, sd_bus_message *m, sd_b
}
static int map_load_error(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
const char *n, *message;
const char **p = userdata;
const char *message, **p = userdata;
int r;
r = sd_bus_message_read(m, "(ss)", &n, &message);
r = sd_bus_message_read(m, "(ss)", NULL, &message);
if (r < 0)
return r;