bus-util: drop unnecessary re-formatting
This commit is contained in:
+33
-32
@@ -4679,9 +4679,9 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (u > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%"PRIu32, u);
|
||||
bus_print_property_valuef(name, expected_value, value, "%"PRIu32, u);
|
||||
else if (all)
|
||||
bus_print_property_value(name, expected_value, value, "%s", "");
|
||||
bus_print_property_value(name, expected_value, value, "");
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -4693,7 +4693,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (all || !isempty(s))
|
||||
bus_print_property_value(name, expected_value, value, "%s", s);
|
||||
bus_print_property_value(name, expected_value, value, s);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -4705,7 +4705,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (all || !isempty(a) || !isempty(b))
|
||||
bus_print_property_value(name, expected_value, value, "%s \"%s\"", strempty(a), strempty(b));
|
||||
bus_print_property_valuef(name, expected_value, value, "%s \"%s\"", strempty(a), strempty(b));
|
||||
|
||||
return 1;
|
||||
} else if (streq_ptr(name, "SystemCallFilter")) {
|
||||
@@ -4752,6 +4752,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
} else if (STR_IN_SET(name, "SELinuxContext", "AppArmorProfile", "SmackProcessLabel")) {
|
||||
int ignore;
|
||||
const char *s;
|
||||
@@ -4761,9 +4762,9 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (!isempty(s))
|
||||
bus_print_property_value(name, expected_value, value, "%s%s", ignore ? "-" : "", s);
|
||||
bus_print_property_valuef(name, expected_value, value, "%s%s", ignore ? "-" : "", s);
|
||||
else if (all)
|
||||
bus_print_property_value(name, expected_value, value, "%s", "");
|
||||
bus_print_property_value(name, expected_value, value, "");
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -4781,7 +4782,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(sb)", &path, &ignore)) > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%s (ignore_errors=%s)", path, yes_no(ignore));
|
||||
bus_print_property_valuef(name, expected_value, value, "%s (ignore_errors=%s)", path, yes_no(ignore));
|
||||
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
@@ -4800,7 +4801,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(ss)", &type, &path)) > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%s (%s)", path, type);
|
||||
bus_print_property_valuef(name, expected_value, value, "%s (%s)", path, type);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
@@ -4818,7 +4819,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(ss)", &type, &path)) > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%s (%s)", path, type);
|
||||
bus_print_property_valuef(name, expected_value, value, "%s (%s)", path, type);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
@@ -4839,9 +4840,9 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
while ((r = sd_bus_message_read(m, "(stt)", &base, &v, &next_elapse)) > 0) {
|
||||
char timespan1[FORMAT_TIMESPAN_MAX], timespan2[FORMAT_TIMESPAN_MAX];
|
||||
|
||||
bus_print_property_value(name, expected_value, value, "{ %s=%s ; next_elapse=%s }", base,
|
||||
format_timespan(timespan1, sizeof(timespan1), v, 0),
|
||||
format_timespan(timespan2, sizeof(timespan2), next_elapse, 0));
|
||||
bus_print_property_valuef(name, expected_value, value, "{ %s=%s ; next_elapse=%s }", base,
|
||||
format_timespan(timespan1, sizeof(timespan1), v, 0),
|
||||
format_timespan(timespan2, sizeof(timespan2), next_elapse, 0));
|
||||
}
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
@@ -4863,8 +4864,8 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
while ((r = sd_bus_message_read(m, "(sst)", &base, &spec, &next_elapse)) > 0) {
|
||||
char timestamp[FORMAT_TIMESTAMP_MAX];
|
||||
|
||||
bus_print_property_value(name, expected_value, value, "{ %s=%s ; next_elapse=%s }", base, spec,
|
||||
format_timestamp(timestamp, sizeof(timestamp), next_elapse));
|
||||
bus_print_property_valuef(name, expected_value, value, "{ %s=%s ; next_elapse=%s }", base, spec,
|
||||
format_timestamp(timestamp, sizeof(timestamp), next_elapse));
|
||||
}
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
@@ -4888,18 +4889,18 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
|
||||
tt = strv_join(info.argv, " ");
|
||||
|
||||
bus_print_property_value(name, expected_value, value,
|
||||
"{ path=%s ; argv[]=%s ; ignore_errors=%s ; start_time=[%s] ; stop_time=[%s] ; pid="PID_FMT" ; code=%s ; status=%i%s%s }",
|
||||
strna(info.path),
|
||||
strna(tt),
|
||||
yes_no(info.ignore),
|
||||
strna(format_timestamp(timestamp1, sizeof(timestamp1), info.start_timestamp)),
|
||||
strna(format_timestamp(timestamp2, sizeof(timestamp2), info.exit_timestamp)),
|
||||
info.pid,
|
||||
sigchld_code_to_string(info.code),
|
||||
info.status,
|
||||
info.code == CLD_EXITED ? "" : "/",
|
||||
strempty(info.code == CLD_EXITED ? NULL : signal_to_string(info.status)));
|
||||
bus_print_property_valuef(name, expected_value, value,
|
||||
"{ path=%s ; argv[]=%s ; ignore_errors=%s ; start_time=[%s] ; stop_time=[%s] ; pid="PID_FMT" ; code=%s ; status=%i%s%s }",
|
||||
strna(info.path),
|
||||
strna(tt),
|
||||
yes_no(info.ignore),
|
||||
strna(format_timestamp(timestamp1, sizeof(timestamp1), info.start_timestamp)),
|
||||
strna(format_timestamp(timestamp2, sizeof(timestamp2), info.exit_timestamp)),
|
||||
info.pid,
|
||||
sigchld_code_to_string(info.code),
|
||||
info.status,
|
||||
info.code == CLD_EXITED ? "" : "/",
|
||||
strempty(info.code == CLD_EXITED ? NULL : signal_to_string(info.status)));
|
||||
|
||||
free(info.path);
|
||||
strv_free(info.argv);
|
||||
@@ -4920,7 +4921,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(ss)", &path, &rwm)) > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%s %s", strna(path), strna(rwm));
|
||||
bus_print_property_valuef(name, expected_value, value, "%s %s", strna(path), strna(rwm));
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
@@ -4940,7 +4941,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(st)", &path, &weight)) > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%s %"PRIu64, strna(path), weight);
|
||||
bus_print_property_valuef(name, expected_value, value, "%s %"PRIu64, strna(path), weight);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
@@ -4961,7 +4962,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(st)", &path, &bandwidth)) > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%s %"PRIu64, strna(path), bandwidth);
|
||||
bus_print_property_valuef(name, expected_value, value, "%s %"PRIu64, strna(path), bandwidth);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
@@ -4982,8 +4983,8 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(st)", &path, &target)) > 0)
|
||||
bus_print_property_value(name, expected_value, value, "%s %s", strna(path),
|
||||
format_timespan(ts, sizeof(ts), target, 1));
|
||||
bus_print_property_valuef(name, expected_value, value, "%s %s", strna(path),
|
||||
format_timespan(ts, sizeof(ts), target, 1));
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
@@ -5007,7 +5008,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
if (n < 0)
|
||||
return log_oom();
|
||||
|
||||
bus_print_property_value(name, expected_value, value, "%s", h);
|
||||
bus_print_property_value(name, expected_value, value, h);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user