diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-09-20 20:38:27 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-09-22 10:16:05 +0200 |
commit | c8b62cf60064b8bcbb95db6e97d1ca3931eba341 (patch) | |
tree | 07570e10ebf60a777ea0c33da2f3ccf95b7703c9 /src/busctl | |
parent | networkctl: use "-" for empty fields (diff) | |
download | systemd-c8b62cf60064b8bcbb95db6e97d1ca3931eba341.tar.xz systemd-c8b62cf60064b8bcbb95db6e97d1ca3931eba341.zip |
shared/format-table: use enum instead of Table.empty_string
All users were setting this to some static string (usually "-"), so let's
simplify things by not doing strdup, but instead limiting callers to a fixed
set of values. In preparation for the next commit, the function is renamed from
"empty" to "replacement", because it'll be used for more than empty fields. I
didn't do the whole string-table setup, because it's all used internally in one
file and this way we can immediately assert if an invalid value is passed in.
Some callers were (void)ing the error, others were ignoring it, and others
propagating. It's nicer to remove the boilerplate.
Diffstat (limited to 'src/busctl')
-rw-r--r-- | src/busctl/busctl.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index 90e42a21da..f57a5d605d 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -209,9 +209,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) { if (r < 0) return log_error_errno(r, "Failed to set alignment: %m"); - r = table_set_empty_string(table, "-"); - if (r < 0) - return log_error_errno(r, "Failed to set empty string: %m"); + table_set_ersatz_string(table, TABLE_ERSATZ_DASH); r = table_set_sort(table, (size_t) COLUMN_NAME); if (r < 0) |