mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
format-table: simplify table_set_display_all() and keep it private
This commit is contained in:
parent
ae43f2341c
commit
c27cb5113f
@ -1078,17 +1078,21 @@ int table_set_empty_string(Table *t, const char *empty) {
|
||||
return free_and_strdup(&t->empty_string, empty);
|
||||
}
|
||||
|
||||
int table_set_display_all(Table *t) {
|
||||
static int table_set_display_all(Table *t) {
|
||||
size_t *d;
|
||||
|
||||
assert(t);
|
||||
|
||||
size_t allocated = t->n_display_map;
|
||||
/* Initialize the display map to the identity */
|
||||
|
||||
if (!GREEDY_REALLOC(t->display_map, allocated, MAX(t->n_columns, allocated)))
|
||||
d = reallocarray(t->display_map, t->n_columns, sizeof(size_t));
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
||||
for (size_t i = 0; i < t->n_columns; i++)
|
||||
t->display_map[i] = i;
|
||||
d[i] = i;
|
||||
|
||||
t->display_map = d;
|
||||
t->n_display_map = t->n_columns;
|
||||
|
||||
return 0;
|
||||
|
@ -100,7 +100,6 @@ void table_set_header(Table *table, bool b);
|
||||
void table_set_width(Table *t, size_t width);
|
||||
void table_set_cell_height_max(Table *t, size_t height);
|
||||
int table_set_empty_string(Table *t, const char *empty);
|
||||
int table_set_display_all(Table *t);
|
||||
int table_set_display_internal(Table *t, size_t first_column, ...);
|
||||
#define table_set_display(...) table_set_display_internal(__VA_ARGS__, SIZE_MAX)
|
||||
int table_set_sort_internal(Table *t, size_t first_column, ...);
|
||||
|
Loading…
x
Reference in New Issue
Block a user