From c8b62cf60064b8bcbb95db6e97d1ca3931eba341 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Tue, 20 Sep 2022 20:38:27 +0200 Subject: 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. --- src/sysext/sysext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sysext') diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index e45fa61640..3dd37b30ca 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -166,7 +166,7 @@ static int verb_status(int argc, char **argv, void *userdata) { if (!t) return log_oom(); - (void) table_set_empty_string(t, "-"); + table_set_ersatz_string(t, TABLE_ERSATZ_DASH); STRV_FOREACH(p, arg_hierarchies) { _cleanup_free_ char *resolved = NULL, *f = NULL, *buf = NULL; -- cgit v1.2.3