return 0;
}
-static const char *strdash(const char *x) {
- return isempty(x) ? "-" : x;
-}
-
static int introspect(int argc, char **argv, void *userdata) {
static const struct hash_ops member_hash_ops = {
.hash = member_hash_func,
rv = ellipsized;
} else
- rv = strdash(m->result);
+ rv = empty_to_dash(m->result);
printf("%s%s%-*s%s %-*s %-*s %-*s%s%s%s%s%s%s\n",
is_interface ? ansi_highlight() : "",
is_interface ? "" : ".",
- - !is_interface + (int) name_width, strdash(streq_ptr(m->type, "interface") ? m->interface : m->name),
+ - !is_interface + (int) name_width, empty_to_dash(streq_ptr(m->type, "interface") ? m->interface : m->name),
is_interface ? ansi_normal() : "",
- (int) type_width, strdash(m->type),
- (int) signature_width, strdash(m->signature),
+ (int) type_width, empty_to_dash(m->type),
+ (int) signature_width, empty_to_dash(m->signature),
(int) result_width, rv,
(m->flags & SD_BUS_VTABLE_DEPRECATED) ? " deprecated" : (m->flags || m->writable ? "" : " -"),
(m->flags & SD_BUS_VTABLE_METHOD_NO_REPLY) ? " no-reply" : "",
r = table_add_many(table,
TABLE_STRING, name,
TABLE_STRING, class,
- TABLE_STRING, strdash_if_empty(service),
- TABLE_STRING, strdash_if_empty(os),
- TABLE_STRING, strdash_if_empty(version_id),
- TABLE_STRING, strdash_if_empty(addresses));
+ TABLE_STRING, empty_to_dash(service),
+ TABLE_STRING, empty_to_dash(os),
+ TABLE_STRING, empty_to_dash(version_id),
+ TABLE_STRING, empty_to_dash(addresses));
if (r < 0)
return log_error_errno(r, "Failed to add table row: %m");
}