tree-wide: drop flush&check step after table printing

Almost all callers of table_print() specify stdout or NULL (equivalent
to stdout) as the output stream. Simplify things by not requiring the
the stream to be specified.

In almost all cases, the printing of the table is surrounded by normal
printfs() that don't do explicit flushing and for which we don't check
the output stream status. Let's simplify most callers and skip this
step. The reason is not so much to avoid the extra step itself, but
instead to avoid the _handling_ of the potential failure. We generally
only want to print an error message for ENOMEM and other "internal"
errors, so strictly speaking we should filter out the errors from the
stream. By skipping the flush&check step we implicitly do this.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-04-03 13:04:40 +02:00
parent 16a43412b9
commit 0ce5a8fb4e
44 changed files with 67 additions and 60 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ static int dump_address_labels(sd_netlink *rtnl) {
return table_log_add_error(r);
}
r = table_print(table, NULL);
r = table_print(table);
if (r < 0)
return table_log_print_error(r);
+1 -1
View File
@@ -79,7 +79,7 @@ int verb_list_links(int argc, char *argv[], uintptr_t _data, void *userdata) {
return table_log_add_error(r);
}
r = table_print(table, NULL);
r = table_print(table);
if (r < 0)
return table_log_print_error(r);
+1 -1
View File
@@ -303,7 +303,7 @@ int verb_link_lldp_status(int argc, char *argv[], uintptr_t _data, void *userdat
}
}
r = table_print(table, NULL);
r = table_print(table);
if (r < 0)
return table_log_print_error(r);
+1 -1
View File
@@ -900,7 +900,7 @@ static int link_status_one(
on_color_operational, glyph(GLYPH_BLACK_CIRCLE), off_color_operational,
info->ifindex, info->name);
r = table_print(table, NULL);
r = table_print(table);
if (r < 0)
return table_log_print_error(r);
+1 -1
View File
@@ -126,7 +126,7 @@ int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
on_color_operational, glyph(GLYPH_BLACK_CIRCLE), off_color_operational,
strna(netifs_joined));
r = table_print(table, NULL);
r = table_print(table);
if (r < 0)
return table_log_print_error(r);