]> git.ipfire.org Git - thirdparty/systemd.git/commit
shared/format-table: use enum instead of Table.empty_string
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 20 Sep 2022 18:38:27 +0000 (20:38 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Sep 2022 08:16:05 +0000 (10:16 +0200)
commitc8b62cf60064b8bcbb95db6e97d1ca3931eba341
tree07570e10ebf60a777ea0c33da2f3ccf95b7703c9
parent5515f2169cb5980996044eabb5f1b35e00fd81eb
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.
16 files changed:
src/busctl/busctl.c
src/coredump/coredumpctl.c
src/dissect/dissect.c
src/hostname/hostnamectl.c
src/locale/localectl.c
src/machine/machinectl.c
src/network/networkctl.c
src/shared/format-table.c
src/shared/format-table.h
src/sysext/sysext.c
src/systemctl/systemctl-list-jobs.c
src/systemctl/systemctl-list-machines.c
src/systemctl/systemctl-list-unit-files.c
src/systemctl/systemctl-list-units.c
src/sysupdate/sysupdate.c
src/userdb/userdbctl.c